Mock user en servidor
This commit is contained in:
parent
fc952b948e
commit
eae539899e
@ -2,14 +2,13 @@ import { EmailAddress, UniqueID } from "@repo/rdx-ddd";
|
||||
import { NextFunction, Response } from "express";
|
||||
import { RequestWithAuth } from "./auth-types";
|
||||
|
||||
export function mockUser(req: RequestWithAuth, res: Response, next: NextFunction) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
req.user = {
|
||||
userId: UniqueID.create("9e4dc5b3-96b9-4968-9490-14bd032fec5f").data,
|
||||
email: EmailAddress.create("dev@example.com").data,
|
||||
companyId: UniqueID.create("5e4dc5b3-96b9-4968-9490-14bd032fec5f").data,
|
||||
roles: ["admin"],
|
||||
};
|
||||
}
|
||||
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,
|
||||
companyId: UniqueID.create("5e4dc5b3-96b9-4968-9490-14bd032fec5f").data,
|
||||
roles: ["admin"],
|
||||
};
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user