Merge branch 'staging' into preprod

This commit is contained in:
Vins 2024-04-24 09:50:56 +02:00
commit f073b761d1
6 changed files with 15 additions and 20 deletions

View File

@ -125,8 +125,6 @@ export default class OfficeRolesController extends ApiController {
} }
if (req.body.rules) { if (req.body.rules) {
console.log(req.body.rules);
const allRules = await this.rulesService.get({ const allRules = await this.rulesService.get({
where: { where: {
namespace: "global", namespace: "global",

View File

@ -121,7 +121,8 @@ export default class UserController extends ApiController {
if(!isSubscribed && userHydrated.role?.name === "admin" || userHydrated.role?.name === "super-admin"){ if(!isSubscribed && userHydrated.role?.name === "admin" || userHydrated.role?.name === "super-admin"){
const manageSubscriptionRulesEntity = await this.rulesGroupsService.get({ where: { name: "Gestion de l'abonnement" }, include: { rules: true } }); const manageSubscriptionRulesEntity = await this.rulesGroupsService.get({ where: { uid: "94343601-04c8-44ef-afb9-3047597528a9" }, include: { rules: true } });
console.log(manageSubscriptionRulesEntity);
const manageSubscriptionRules = RulesGroup.hydrateArray<RulesGroup>(manageSubscriptionRulesEntity, { strategy: "excludeAll" }); const manageSubscriptionRules = RulesGroup.hydrateArray<RulesGroup>(manageSubscriptionRulesEntity, { strategy: "excludeAll" });
if(!manageSubscriptionRules[0]) return; if(!manageSubscriptionRules[0]) return;
@ -129,6 +130,7 @@ export default class UserController extends ApiController {
isSubscribed = true; isSubscribed = true;
} }
if (!isSubscribed) { if (!isSubscribed) {
this.httpUnauthorized(response, "User not subscribed"); this.httpUnauthorized(response, "User not subscribed");
return; return;

View File

@ -157,12 +157,6 @@ export class BackendVariables {
@IsNotEmpty() @IsNotEmpty()
public readonly STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID!: string; public readonly STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID!: string;
@IsNotEmpty()
public readonly STRIPE_PAYMENT_SUCCESS_URL!: string;
@IsNotEmpty()
public readonly STRIPE_PAYMENT_CANCEL_URL!: string;
@IsNotEmpty() @IsNotEmpty()
public readonly IDNOT_PROD_BASE_URL!: string; public readonly IDNOT_PROD_BASE_URL!: string;
@ -219,8 +213,6 @@ export class BackendVariables {
this.STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID = process.env["STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID"]!; this.STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID = process.env["STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID"]!;
this.STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID = process.env["STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID"]!; this.STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID = process.env["STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID"]!;
this.STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID = process.env["STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID"]!; this.STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID = process.env["STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID"]!;
this.STRIPE_PAYMENT_SUCCESS_URL = process.env["STRIPE_PAYMENT_SUCCESS_URL"]!;
this.STRIPE_PAYMENT_CANCEL_URL = process.env["STRIPE_PAYMENT_CANCEL_URL"]!;
this.IDNOT_PROD_BASE_URL = process.env["IDNOT_PROD_BASE_URL"]!; this.IDNOT_PROD_BASE_URL = process.env["IDNOT_PROD_BASE_URL"]!;
} }
public async validate(groups?: string[]) { public async validate(groups?: string[]) {

View File

@ -874,6 +874,7 @@ export default async function main() {
}, },
{ {
name: "Gestion de l'abonnement", name: "Gestion de l'abonnement",
uid: "94343601-04c8-44ef-afb9-3047597528a9",
created_at: new Date(), created_at: new Date(),
updated_at: new Date(), updated_at: new Date(),
rules : [ rules : [
@ -1973,6 +1974,7 @@ export default async function main() {
for (const ruleGroup of rulesGroups) { for (const ruleGroup of rulesGroups) {
await prisma.rulesGroups.create({ await prisma.rulesGroups.create({
data: { data: {
uid: ruleGroup.uid,
name: ruleGroup.name, name: ruleGroup.name,
rules: { rules: {
connect: ruleGroup.rules?.map((rule) => ({ connect: ruleGroup.rules?.map((rule) => ({

View File

@ -122,6 +122,7 @@ export default class IdNotService extends BaseService {
grant_type: "authorization_code", grant_type: "authorization_code",
}); });
const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" }); const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" });
if(token.status !== 200) console.error(await token.text()); if(token.status !== 200) console.error(await token.text());