定时任务增加置顶功能

This commit is contained in:
hanhh
2021-09-19 22:25:57 +08:00
parent 1cc54b5da6
commit aa08f489d7
3 changed files with 152 additions and 2 deletions
+36
View File
@@ -191,6 +191,42 @@ export default (app: Router) => {
},
);
route.put(
'/crons/pin',
celebrate({
body: Joi.array().items(Joi.string().required()),
}),
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const cronService = Container.get(CronService);
const data = await cronService.pin(req.body);
return res.send({ code: 200, data });
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
},
);
route.put(
'/crons/unpin',
celebrate({
body: Joi.array().items(Joi.string().required()),
}),
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const cronService = Container.get(CronService);
const data = await cronService.unPin(req.body);
return res.send({ code: 200, data });
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
},
);
route.get(
'/crons/import',
async (req: Request, res: Response, next: NextFunction) => {