A social media platform for pet lovers and their pets. Utilizes React, Redux, GraphQL, node, Express, JWT, image uploads with Cloudinary, MongoDB and Mongoose. Deployed to Heroku.
Figure out a way to store images that a user uploads, either in the cloud or in Mongo. Cloud is probably preferable since it won't overwhelm our DB with large files.
Here is the initial list of Mutations we are defining in typeDefs
login
addPet
addPost
addComment
addFriend
addProfileImage(imageUrl: String!): User
For login-addFriend, refer to the logic we used with Deep Thoughts. If you want to add or change anything, just let me know. I am definitely open to anything that would make us stand out from Deep Thoughts more.
The one that is going to be different is the addProfileImage. It is going to be an update mutation that will find a specific user and update their profile image. Use "addFriend" as a reference. It will accept imageUrl as a parameter (taking the place of friendId in the addFriend resolver). It will be using the _id from the context just like addFriend. In place of the addToSet code, we will want something like: { image: imageUrl} (I think). New should be true.
Comment Form
Comment List
Footer
Friends List
Header
Nav
Pet Card
Post Form
Post List
Profile Image
React Bootstrap Login Form for Login.js and Signup.js
Below is a list of TypeDefs that we need set up on the back end. Type Query is already done, it just needs to be uncommented in typeDefs.js. Likewise, the addProfileImage mutation is already done. For the rest of them, I just left a comment to mark what we want to return with our typeDefs. You will have to add the datatype (String, Int, etc.) Refer to the models if you are unsure what datatype to use. Feel free to reach out with questions.
type PET
_id
username
email
petType
image
age
sex
bio
humanStatus
tails
friends
friendCount
type TAIL
_id
tailText
createdAt
petUsername
comments
commentCount
type COMMENT
_id
commentText
createdAt
petUsername
type Auth
token
pet
Type Query just needs to be uncommented
type Query {
me: Pet
pets: [Pet]
pet(petUsername: String!): Pet
tails(petUsername: String): [Tail]
tail(_id: ID!): Tail
}
type Mutation
login
addPet
addTail
addComment
addFriend
addProfileImage(imageUrl: String!): User (add image is already done, it just needs to be uncommented)
When you use the addTail mutation, the tail is added to the db, but the postedBy field only returns the userID and it does not populate the username and image fields. This causes the existing TailList on the Profile page to lose its reference to the username and image, and it prevents the Apollo cache from being updated.
Expected Outcome
postedBy should be populated by _id, username, and image
Actual Outcome
postedBy only contains the _id, and the username and image fields are returned null.