Deploy logs prod
This commit is contained in:
parent
b5f4e23826
commit
1abab5dad2
@ -57,7 +57,8 @@ export default class UserController extends ApiController {
|
||||
|
||||
//Whitelist feature
|
||||
//Get user with contact
|
||||
const prismaUser = await this.userService.getByUid(user.uid, { contact: true, role: true, office_membership: true});
|
||||
const prismaUser = await this.userService.getByUid(user.uid, { contact: true, role: true, office_membership: true});
|
||||
console.log(prismaUser);
|
||||
|
||||
if (!prismaUser) {
|
||||
this.httpNotFoundRequest(response, "user not found");
|
||||
@ -66,6 +67,7 @@ export default class UserController extends ApiController {
|
||||
|
||||
//Hydrate user to be able to use his contact
|
||||
const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" });
|
||||
console.log(userHydrated);
|
||||
|
||||
if (!userHydrated.contact?.email || userHydrated.contact?.email === "") {
|
||||
this.httpUnauthorized(response, "Email not found");
|
||||
@ -73,14 +75,18 @@ export default class UserController extends ApiController {
|
||||
}
|
||||
let isSubscribed = false;
|
||||
|
||||
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);
|
||||
|
||||
if (!subscriptions || subscriptions.length === 0 || subscriptions[0]?.status === ESubscriptionStatus.INACTIVE) {
|
||||
if (!subscriptions || subscriptions.length === 0 || subscriptions[0]?.status === ESubscriptionStatus.INACTIVE) {
|
||||
console.log("No subscription found");
|
||||
isSubscribed = false;
|
||||
}
|
||||
else if (subscriptions[0]?.type === EType.Unlimited) {
|
||||
else if (subscriptions[0]?.type === EType.Unlimited) {
|
||||
console.log("Unlimited subscription found");
|
||||
isSubscribed = true;
|
||||
} else {
|
||||
} else {
|
||||
console.log("Standard subscription found");
|
||||
const hasSeat = await this.subscriptionsService.get({
|
||||
where: { status: ESubscriptionStatus.ACTIVE, seats: { some: { user_uid: userHydrated.uid } } },
|
||||
});
|
||||
@ -116,9 +122,11 @@ export default class UserController extends ApiController {
|
||||
|
||||
await this.idNotService.updateOffice(user.office_uid);
|
||||
|
||||
const payload = await this.authService.getUserJwtPayload(user.idNot);
|
||||
const payload = await this.authService.getUserJwtPayload(user.idNot);
|
||||
console.log(payload);
|
||||
if(!payload) return;
|
||||
|
||||
console.log(isSubscribed, userHydrated.role?.name);
|
||||
if(!isSubscribed && userHydrated.role?.name === "admin" || userHydrated.role?.name === "super-admin"){
|
||||
const manageSubscriptionRulesEntity = await this.rulesGroupsService.get({ where: { uid: "94343601-04c8-44ef-afb9-3047597528a9" }, include: { rules: true } });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user