Merge branch 'staging' into preprod

This commit is contained in:
Vins 2024-04-24 11:05:40 +02:00
commit 067b0392ed

View File

@ -46,7 +46,9 @@ export default class UserController extends ApiController {
return;
}
const user = await this.idNotService.getOrCreateUser(idNotToken);
const user = await this.idNotService.getOrCreateUser(idNotToken);
console.log(user);
if (!user) {
this.httpUnauthorized(response, "User not found");
@ -57,7 +59,9 @@ export default class UserController extends ApiController {
//Whitelist feature
//Get user with contact
const prismaUser = await this.userService.getByUid(user.uid, { contact: true, role: true });
const prismaUser = await this.userService.getByUid(user.uid, { contact: true, role: true });
console.log(prismaUser);
if (!prismaUser) {
this.httpNotFoundRequest(response, "user not found");
@ -65,7 +69,9 @@ export default class UserController extends ApiController {
}
//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" });
console.log(userHydrated);
if (!userHydrated.contact?.email || userHydrated.contact?.email === "") {
this.httpUnauthorized(response, "Email not found");
@ -75,8 +81,7 @@ export default class UserController extends ApiController {
const subscriptions = await this.subscriptionsService.get({ where: { office_uid: userHydrated.office_membership?.uid } });
console.log(subscriptions);
if (!subscriptions || subscriptions.length === 0 || subscriptions[0]?.status === ESubscriptionStatus.INACTIVE) {
console.log("no subscription");