2024-06-14 12:07:20 +00:00
|
|
|
import { checkUser } from "@/contexts/auth";
|
|
|
|
|
import { createGetProfileController } from "@/contexts/profile/infrastructure";
|
|
|
|
|
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);
|
|
|
|
|
};
|