GansukhB / philosophy

Philosophy App
2 stars 0 forks source link

Follow/Unfollow user #17

Closed GansukhB closed 2 years ago

GansukhB commented 2 years ago

-[] Follow model

"followerId": <id of user following>,
"followingId": <id of user being followed
timestamps: true

-[] Follow user requests

Method: POST URL: /follow

{
"userId": <id of user to be followed>
}
followerId-g access token-s авч хадгална

Response:

success
{
"message": "followed",
}

If there is no user found with id:

statusCode: 404
{
"message": "user not found
}

Хэрэглэгч бие биеэ дагасан тохиолдолд

statusCode: 200
{
"message": "followed",
}
GansukhB commented 2 years ago

2 user-ийн ID талбарыг mongoose objectId ашиглана.

https://mongoosejs.com/docs/populate.html жишээ харах.