Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/ban unban #27

Merged
merged 7 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions backend/controllers/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
* @param req The Express request object
* @param res The Express response object
*/
public static async muteUser(req: express.Request, res: express.Response) {

Check warning on line 118 in backend/controllers/Account.ts

View workflow job for this annotation

GitHub Actions / lint

'req' is defined but never used

Check warning on line 118 in backend/controllers/Account.ts

View workflow job for this annotation

GitHub Actions / lint

'res' is defined but never used
// TODO: Mute/unmute a user
/**
* VALIDATION
Expand All @@ -139,19 +139,19 @@
* @param res The Express response object
*/
public static async banUser(req: express.Request, res: express.Response) {
// TODO: Ban/unban a user
/**
* VALIDATION
* * Check if the user is an admin
* * Validate the user ID
*
* PROCESS
* * Ban/unban the user
*
* RESPONSE
* * Send a success message
* * Send an error message if the user ID is invalid
*/
const { userId, isBanned } = req.body;

try {
await prisma.account.update({
where: { id: userId },
data: { isBanned: isBanned }
});

res.status(200).send("Successful");
} catch (error) {
res.status(500).send("Not successful");
return;
}
}

/**
Expand All @@ -173,4 +173,4 @@
}
}

export default AccountController;
export default AccountController;
Loading