The main function of the Comment service is to create and fetch comments of a post and the count of comments.
Although noSQL database is used but a proper Schema is maintained.
Attribute | Type | Description |
---|---|---|
_id |
ObjectId |
userId of user (Primary Key) |
userName |
string |
userName of the user |
email |
string |
email of the user |
firstName |
string |
first name of the user |
lastName |
string |
last name of the user |
bio |
string |
bio of the user |
gender |
string |
gender of the user |
profileImage |
string |
url of profile image of the user |
Gets the profile info of a user with id userId
GET /api/user/:userId/profile
Gets the name and username of a user
GET /api/user/:userId/profile/forPost
Upload a new profile image
PUT /api/user/:userId/profile/image
Delete the previous profile image
DELETE /api/user/:userId/profile/image
Handlers consumes events from NATS stream and processes them.
It consumes the UserCreatedEvent and processes it to create a document related to that user in UserProfileCollection .