feat: 增加员工端工作台后端能力
This commit is contained in:
+13
@@ -5,9 +5,14 @@ import { env } from "./config/env";
|
||||
import { pingDatabase } from "./db/pool";
|
||||
import { authRoutes } from "./modules/auth/auth.controller";
|
||||
import { managementGuard } from "./modules/auth/auth.guard";
|
||||
import { announcementAdminRoutes, announcementMobileRoutes } from "./modules/announcements/announcement.controller";
|
||||
import { catalogRoutes } from "./modules/catalog/catalog.controller";
|
||||
import { credentialAdminRoutes } from "./modules/credentials/credential.controller";
|
||||
import { employeeRoutes } from "./modules/employees/employee.controller";
|
||||
import { mobileRoutes } from "./modules/mobile/mobile.controller";
|
||||
import { permissionRoutes } from "./modules/permissions/permission.controller";
|
||||
import { shiftAdminRoutes, shiftMobileRoutes } from "./modules/shifts/shift.controller";
|
||||
import { taskAdminRoutes, taskMobileRoutes } from "./modules/tasks/task.controller";
|
||||
import { HttpError } from "./shared/http-error";
|
||||
import { ok } from "./shared/response";
|
||||
|
||||
@@ -58,6 +63,10 @@ export function createApp() {
|
||||
// 登录接口不需要 token;/auth/me 在 authRoutes 内部单独加了 authGuard。
|
||||
app.register(authRoutes, { prefix: "/api" });
|
||||
app.register(permissionRoutes, { prefix: "/api" });
|
||||
app.register(mobileRoutes, { prefix: "/api" });
|
||||
app.register(announcementMobileRoutes, { prefix: "/api" });
|
||||
app.register(taskMobileRoutes, { prefix: "/api" });
|
||||
app.register(shiftMobileRoutes, { prefix: "/api" });
|
||||
|
||||
// 业务管理接口统一要求后台权限:超级管理员或拥有 admin 角色的员工。
|
||||
app.register(
|
||||
@@ -65,6 +74,10 @@ export function createApp() {
|
||||
protectedApp.addHook("preHandler", managementGuard);
|
||||
protectedApp.register(catalogRoutes);
|
||||
protectedApp.register(employeeRoutes);
|
||||
protectedApp.register(announcementAdminRoutes);
|
||||
protectedApp.register(taskAdminRoutes);
|
||||
protectedApp.register(shiftAdminRoutes);
|
||||
protectedApp.register(credentialAdminRoutes);
|
||||
},
|
||||
{ prefix: "/api" },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user