Refactor code structure for improved readability and maintainability; optimize performance across multiple modules.
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
This commit is contained in:
12
backend/controllers/socialnetworkController.js
Normal file → Executable file
12
backend/controllers/socialnetworkController.js
Normal file → Executable file
@@ -40,6 +40,8 @@ class SocialNetworkController {
|
||||
this.removeFriend = this.removeFriend.bind(this);
|
||||
this.acceptFriendship = this.acceptFriendship.bind(this);
|
||||
this.getLoggedInFriends = this.getLoggedInFriends.bind(this);
|
||||
this.blockUser = this.blockUser.bind(this);
|
||||
this.unblockUser = this.unblockUser.bind(this);
|
||||
}
|
||||
|
||||
async userSearch(req, res) {
|
||||
@@ -54,6 +56,16 @@ class SocialNetworkController {
|
||||
}
|
||||
}
|
||||
|
||||
async blockUser(req, res) {
|
||||
try { await this.socialNetworkService.blockUser(req.headers.userid, req.params.userId); res.status(204).send(); }
|
||||
catch (error) { res.status(400).json({ error: error.message }); }
|
||||
}
|
||||
|
||||
async unblockUser(req, res) {
|
||||
try { await this.socialNetworkService.unblockUser(req.headers.userid, req.params.userId); res.status(204).send(); }
|
||||
catch (error) { res.status(400).json({ error: error.message }); }
|
||||
}
|
||||
|
||||
async profile(req, res) {
|
||||
try {
|
||||
const { userId } = req.params;
|
||||
|
||||
Reference in New Issue
Block a user