Uecko_ERP/modules/auth/src/api/lib/express/mock-user.middleware.ts

17 lines
544 B
TypeScript
Raw Normal View History

2025-08-26 18:55:59 +00:00
import { EmailAddress, UniqueID } from "@repo/rdx-ddd";
2025-11-19 16:05:01 +00:00
import type { NextFunction, Response } from "express";
import type { RequestWithAuth } from "./auth-types";
2025-08-26 18:55:59 +00:00
2025-11-04 11:23:56 +00:00
export function mockUser(req: RequestWithAuth, _res: Response, next: NextFunction) {
req.user = {
userId: UniqueID.create("9e4dc5b3-96b9-4968-9490-14bd032fec5f").data,
email: EmailAddress.create("dev@example.com").data,
2025-11-21 18:42:17 +00:00
companyId: UniqueID.create("019a9667-6a65-767a-a737-48234ee50a3a").data,
2025-11-28 15:00:18 +00:00
companySlug: "alonsoysal",
2025-11-04 11:23:56 +00:00
roles: ["admin"],
};
2025-08-26 18:55:59 +00:00
next();
}