63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
/* import {
|
|
ICreateAccountRequestSchema,
|
|
IGetAccountRequestSchema,
|
|
IUpdateAccountRequestSchema,
|
|
ListAccountsRequestSchema,
|
|
} from "@/contexts/accounts/presentation";
|
|
import {
|
|
buildCreateAccountController,
|
|
buildGetAccountController,
|
|
buildListAccountsController,
|
|
buildUpdateAccountController,
|
|
} from "@/contexts/accounts/presentation/controllers";
|
|
import { checkTabContext } from "@/contexts/auth/infraestructure";
|
|
import { validateAndParseBody } from "@/core/common/presentation";
|
|
import { NextFunction, Request, Response, Router } from "express";
|
|
|
|
export const accountsRouter = (appRouter: Router) => {
|
|
const routes: Router = Router({ mergeParams: true });
|
|
|
|
routes.get(
|
|
"/",
|
|
validateAndParseBody(ListAccountsRequestSchema),
|
|
checkTabContext,
|
|
//checkUser,
|
|
(req: Request, res: Response, next: NextFunction) => {
|
|
buildListAccountsController().execute(req, res, next);
|
|
}
|
|
);
|
|
|
|
routes.get(
|
|
"/:invoiceId",
|
|
validateAndParseBody(IGetAccountRequestSchema),
|
|
checkTabContext,
|
|
//checkUser,
|
|
(req: Request, res: Response, next: NextFunction) => {
|
|
buildGetAccountController().execute(req, res, next);
|
|
}
|
|
);
|
|
|
|
routes.post(
|
|
"/",
|
|
validateAndParseBody(ICreateAccountRequestSchema),
|
|
checkTabContext,
|
|
//checkUser,
|
|
(req: Request, res: Response, next: NextFunction) => {
|
|
buildCreateAccountController().execute(req, res, next);
|
|
}
|
|
);
|
|
|
|
routes.put(
|
|
"/:invoiceId",
|
|
validateAndParseBody(IUpdateAccountRequestSchema),
|
|
checkTabContext,
|
|
//checkUser,
|
|
(req: Request, res: Response, next: NextFunction) => {
|
|
buildUpdateAccountController().execute(req, res, next);
|
|
}
|
|
);
|
|
|
|
appRouter.use("/accounts", routes);
|
|
};
|
|
*/
|