添加通知api

This commit is contained in:
whyour
2021-09-17 18:06:14 +08:00
parent f2dac51a62
commit bb0ad6c325
4 changed files with 44 additions and 14 deletions
+31 -1
View File
@@ -86,7 +86,7 @@ export default (app: Router) => {
code: 200,
data: {
username: authInfo.username,
twoFactorActived: authInfo.twoFactorActived,
twoFactorActivated: authInfo.twoFactorActivated,
},
});
} catch (e) {
@@ -182,4 +182,34 @@ export default (app: Router) => {
}
},
);
route.get(
'/user/notification',
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const authService = Container.get(AuthService);
const data = await authService.getNotificationMode();
res.send({ code: 200, data });
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
},
);
route.put(
'/user/notification',
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const authService = Container.get(AuthService);
const data = await authService.updateNotificationMode(req.body);
res.send({ code: 200, data });
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
},
);
};