Merge branch 'dev' into staging
This commit is contained in:
commit
68e6abf0b2
@ -46,7 +46,9 @@ export default class UserController extends ApiController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await this.idNotService.getOrCreateUser(idNotToken);
|
const user = await this.idNotService.getOrCreateUser(idNotToken);
|
||||||
|
console.log(user);
|
||||||
|
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
this.httpUnauthorized(response, "User not found");
|
this.httpUnauthorized(response, "User not found");
|
||||||
@ -57,7 +59,9 @@ export default class UserController extends ApiController {
|
|||||||
|
|
||||||
//Whitelist feature
|
//Whitelist feature
|
||||||
//Get user with contact
|
//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) {
|
if (!prismaUser) {
|
||||||
this.httpNotFoundRequest(response, "user not found");
|
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
|
//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 === "") {
|
if (!userHydrated.contact?.email || userHydrated.contact?.email === "") {
|
||||||
this.httpUnauthorized(response, "Email not found");
|
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 } });
|
const subscriptions = await this.subscriptionsService.get({ where: { office_uid: userHydrated.office_membership?.uid } });
|
||||||
console.log(subscriptions);
|
console.log(subscriptions);
|
||||||
|
|
||||||
|
|
||||||
if (!subscriptions || subscriptions.length === 0 || subscriptions[0]?.status === ESubscriptionStatus.INACTIVE) {
|
if (!subscriptions || subscriptions.length === 0 || subscriptions[0]?.status === ESubscriptionStatus.INACTIVE) {
|
||||||
console.log("no subscription");
|
console.log("no subscription");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user