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:
6
backend/controllers/settingsController.js
Normal file → Executable file
6
backend/controllers/settingsController.js
Normal file → Executable file
@@ -68,6 +68,9 @@ class SettingsController {
|
||||
async getAccountSettings(req, res) {
|
||||
try {
|
||||
const { userId } = req.body;
|
||||
if (userId !== req.headers.userid) {
|
||||
return res.status(403).json({ error: 'Access denied' });
|
||||
}
|
||||
const accountSettings = await settingsService.getAccountSettings(userId);
|
||||
res.status(200).json(accountSettings);
|
||||
} catch (error) {
|
||||
@@ -86,6 +89,9 @@ class SettingsController {
|
||||
return res.status(400).json({ error: error.details[0].message });
|
||||
}
|
||||
try {
|
||||
if (value.userId !== req.headers.userid) {
|
||||
return res.status(403).json({ error: 'Access denied' });
|
||||
}
|
||||
await settingsService.setAccountSettings(value);
|
||||
res.status(200).json({ message: 'Account settings updated successfully' });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user