Fixed email empty

This commit is contained in:
Vins 2024-01-12 15:19:50 +01:00
parent c6335996a6
commit 2810a37bd4

View File

@ -34,7 +34,7 @@ export default class UserController extends ApiController {
return; return;
} }
const user = await this.idNotService.getOrCreateUser(idNotToken); const user = await this.idNotService.getOrCreateUser(idNotToken);
if(!user) { if(!user) {
this.httpUnauthorized(response, "Email not found"); this.httpUnauthorized(response, "Email not found");
@ -47,13 +47,13 @@ export default class UserController extends ApiController {
if (!prismaUser) { if (!prismaUser) {
this.httpNotFoundRequest(response, "user not found"); this.httpNotFoundRequest(response, "user not found");
return; return;
} }
//Hydrate user to be able to use his contact //Hydrate user to be able to use his contact
const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" }); const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" });
if(!userHydrated.contact?.email || userHydrated.contact?.email === "") { if(!userHydrated.contact?.email || userHydrated.contact?.email === "") {
this.httpBadRequest(response, "Email not found"); this.httpUnauthorized(response, "Email not found");
return; return;
} }