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