Presupuestador_web/server/src/infrastructure/express/api/routes/profile.routes.ts

27 lines
809 B
TypeScript
Raw Normal View History

2024-06-14 12:07:20 +00:00
import { checkUser } from "@/contexts/auth";
2024-06-17 20:58:08 +00:00
import {
createGetProfileController,
createUpdateProfileController,
} from "@/contexts/profile/infrastructure";
2024-06-14 12:07:20 +00:00
import Express from "express";
export const profileRouter = (appRouter: Express.Router) => {
const profileRoutes: Express.Router = Express.Router({ mergeParams: true });
profileRoutes.get(
"/",
checkUser,
(req: Express.Request, res: Express.Response, next: Express.NextFunction) =>
createGetProfileController(res.locals["context"]).execute(req, res, next)
);
profileRoutes.put(
"/",
checkUser,
(req: Express.Request, res: Express.Response, next: Express.NextFunction) =>
2024-06-17 16:54:30 +00:00
createUpdateProfileController(res.locals["context"]).execute(req, res, next)
2024-06-14 12:07:20 +00:00
);
appRouter.use("/profile", profileRoutes);
};