open-renamer/openRenamerBackend/api/ApplicationRuleApi.ts

39 lines
851 B
TypeScript
Raw Normal View History

2021-12-06 23:26:38 +08:00
import { Context } from "koa";
import ApplicationRuleService from "../service/ApplicationRuleService";
const router = {};
/**
*
*/
router["GET /applicationRule"] = async function (ctx: Context) {
ctx.body = await ApplicationRuleService.getAll();
};
2022-11-29 23:02:06 +08:00
/**
*
*/
router["GET /applicationRule/default"] = async function (ctx: Context) {
;
ctx.body = await ApplicationRuleService.getDefault();
};
2021-12-06 23:26:38 +08:00
/**
*
*/
router['POST /applicationRule'] = async function (ctx: Context) {
ctx.body = await ApplicationRuleService.saveOrAdd(ctx.request.body);
}
/**
*
*/
router["DELETE /applicationRule/:id"] = async function (ctx: Context) {
await ApplicationRuleService.deleteById(ctx.params.id);
ctx.body = "";
};
2022-11-29 23:02:06 +08:00
2021-12-06 23:26:38 +08:00
export default router;