FactuGES_ERP/apps/server/src/routes/accounts.routes.ts

63 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-05-04 20:06:57 +00:00
/* import {
2025-03-18 08:05:00 +00:00
ICreateAccountRequestSchema,
IGetAccountRequestSchema,
IUpdateAccountRequestSchema,
ListAccountsRequestSchema,
2025-05-02 21:43:51 +00:00
} from "@/contexts/accounts/presentation";
2025-03-04 17:08:33 +00:00
import {
2025-04-01 14:26:15 +00:00
buildCreateAccountController,
buildGetAccountController,
buildListAccountsController,
buildUpdateAccountController,
2025-05-02 21:43:51 +00:00
} from "@/contexts/accounts/presentation/controllers";
import { checkTabContext } from "@/contexts/auth/infraestructure";
import { validateAndParseBody } from "@/core/common/presentation";
2025-02-21 11:25:46 +00:00
import { NextFunction, Request, Response, Router } from "express";
2025-02-25 17:47:42 +00:00
export const accountsRouter = (appRouter: Router) => {
2025-02-24 19:00:28 +00:00
const routes: Router = Router({ mergeParams: true });
2025-02-21 11:25:46 +00:00
2025-02-24 19:00:28 +00:00
routes.get(
2025-02-21 11:25:46 +00:00
"/",
2025-04-01 17:05:17 +00:00
validateAndParseBody(ListAccountsRequestSchema),
2025-02-21 11:25:46 +00:00
checkTabContext,
//checkUser,
(req: Request, res: Response, next: NextFunction) => {
2025-04-01 14:26:15 +00:00
buildListAccountsController().execute(req, res, next);
2025-02-21 11:25:46 +00:00
}
);
2025-03-04 17:08:33 +00:00
routes.get(
2025-03-18 08:05:00 +00:00
"/:invoiceId",
2025-04-01 17:05:17 +00:00
validateAndParseBody(IGetAccountRequestSchema),
2025-03-04 17:08:33 +00:00
checkTabContext,
//checkUser,
(req: Request, res: Response, next: NextFunction) => {
2025-04-01 14:26:15 +00:00
buildGetAccountController().execute(req, res, next);
2025-03-04 17:08:33 +00:00
}
);
routes.post(
"/",
2025-04-01 17:05:17 +00:00
validateAndParseBody(ICreateAccountRequestSchema),
2025-03-04 17:08:33 +00:00
checkTabContext,
//checkUser,
(req: Request, res: Response, next: NextFunction) => {
2025-04-01 14:26:15 +00:00
buildCreateAccountController().execute(req, res, next);
2025-03-04 17:08:33 +00:00
}
);
routes.put(
2025-03-18 08:05:00 +00:00
"/:invoiceId",
2025-04-01 17:05:17 +00:00
validateAndParseBody(IUpdateAccountRequestSchema),
2025-03-04 17:08:33 +00:00
checkTabContext,
//checkUser,
(req: Request, res: Response, next: NextFunction) => {
2025-04-01 14:26:15 +00:00
buildUpdateAccountController().execute(req, res, next);
2025-03-04 17:08:33 +00:00
}
);
2025-02-25 17:47:42 +00:00
appRouter.use("/accounts", routes);
2025-02-21 11:25:46 +00:00
};
2025-05-04 20:06:57 +00:00
*/