Merging staging into ppd
This commit is contained in:
commit
51ea48a386
2
.github/workflows/stg.yml
vendored
2
.github/workflows/stg.yml
vendored
@ -187,7 +187,7 @@ jobs:
|
||||
uses: scaleway/action-scw@v0
|
||||
- name: Get container ID
|
||||
run: |
|
||||
echo "CONTAINER_ID=$(scw container container list namespace-id=${{env.NAMESPACE_ID_LECOFFRE}} -o json | jq -r '.[] | select(.name == "cron") | .id')" >> $GITHUB_ENV
|
||||
echo "CONTAINER_ID=$(scw container container list namespace-id=${{env.NAMESPACE_ID}} -o json | jq -r '.[] | select(.name == "cron") | .id')" >> $GITHUB_ENV
|
||||
env:
|
||||
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}
|
||||
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
|
||||
|
@ -75,6 +75,17 @@ export default class OfficeRolesController extends ApiController {
|
||||
//init IOfficeRole resource with request body values
|
||||
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
||||
|
||||
const allRules = await this.rulesService.get({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
namespace: "global",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
officeRoleEntity.rules = allRules;
|
||||
//validate officeRole
|
||||
await validateOrReject(officeRoleEntity, { groups: ["createOfficeRole"] });
|
||||
|
||||
@ -114,23 +125,28 @@ export default class OfficeRolesController extends ApiController {
|
||||
}
|
||||
|
||||
if (req.body.rules) {
|
||||
console.log(req.body.rules);
|
||||
|
||||
const allRules = await this.rulesService.get({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
});
|
||||
|
||||
const specificRules = await this.rulesService.get({
|
||||
where: {
|
||||
namespace: "collaborator",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
req.body.rules = req.body.rules.filter((rule: any) => {
|
||||
const ruleFound = allRules.find((r) => r.uid === rule.uid && (r.namespace === "notary" || r.namespace === "collaborator"));
|
||||
const ruleFound = specificRules.find(
|
||||
(r) => r.uid === rule.uid && (r.namespace === "collaborator"),
|
||||
);
|
||||
return ruleFound;
|
||||
});
|
||||
|
||||
req.body.rules = req.body.rules.concat(allRules);
|
||||
}
|
||||
//init IOfficeRole resource with request body values
|
||||
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import authHandler from "@App/middlewares/AuthHandler";
|
||||
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||
// import roleHandler from "@App/middlewares/RolesHandler";
|
||||
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||
import { Controller, Get, Post} from "@ControllerPattern/index";
|
||||
@ -18,7 +19,7 @@ export default class StripeController extends ApiController {
|
||||
/**
|
||||
* @description Create a new checkout session
|
||||
*/
|
||||
@Post("/api/v1/admin/stripe", [authHandler])
|
||||
@Post("/api/v1/admin/stripe", [authHandler, ruleHandler])
|
||||
protected async createStripeSubscriptionCheckout(req: Request, response: Response) {
|
||||
try {
|
||||
const officeId: string = req.body.user.office_Id;
|
||||
@ -41,33 +42,25 @@ export default class StripeController extends ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
// @Put("/api/v1/admin/stripe/:uid")
|
||||
// protected async createStripeSubscriptionUpdateCheckout(req: Request, response: Response) {
|
||||
// try {
|
||||
// const uid = req.params["uid"];
|
||||
// if (!uid) {
|
||||
// this.httpBadRequest(response, "No uid provided");
|
||||
// return;
|
||||
// }
|
||||
// const officeId: string = req.body.user.office_Id;
|
||||
// //add office id to request body
|
||||
// req.body.office = { uid: officeId };
|
||||
@Get("/api/v1/admin/stripe/:uid")
|
||||
protected async getStripeSubscriptionByUid(req: Request, response: Response) {
|
||||
try {
|
||||
const uid = req.params["uid"];
|
||||
if (!uid) {
|
||||
this.httpBadRequest(response, "No uid provided");
|
||||
return;
|
||||
}
|
||||
|
||||
// //init Subscription resource with request body values
|
||||
// const subscriptionEntity = Subscription.hydrate<Subscription>(req.body, { strategy: "excludeAll" });
|
||||
const stripe_subscription = await this.stripeService.getStripeSubscriptionByUid(uid);
|
||||
|
||||
// await validateOrReject(subscriptionEntity, { groups: ["updateSubscription"], forbidUnknownValues: false });
|
||||
this.httpSuccess(response, stripe_subscription);
|
||||
} catch (error) {
|
||||
this.httpInternalError(response, error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// const stripeSession = await this.stripeService.createCheckoutSessionUpdate(uid, subscriptionEntity);
|
||||
|
||||
// this.httpCreated(response, stripeSession);
|
||||
// } catch (error) {
|
||||
// this.httpInternalError(response, error);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
@Get("/api/v1/admin/stripe/:uid", [authHandler])
|
||||
@Get("/api/v1/admin/stripe/:uid/client-portal", [authHandler, ruleHandler])
|
||||
protected async getClientPortalSession(req: Request, response: Response) {
|
||||
try {
|
||||
const uid = req.params["uid"];
|
||||
|
@ -2,16 +2,13 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index";
|
||||
import { Response, Request } from "express";
|
||||
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||
import { Service } from "typedi";
|
||||
// import authHandler from "@App/middlewares/AuthHandler";
|
||||
// import roleHandler from "@App/middlewares/RolesHandler";
|
||||
// import ruleHandler from "@App/middlewares/RulesHandler";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import SubscriptionsService from "@Services/admin/SubscriptionsService/SubscriptionsService.ts";
|
||||
import { Subscription } from "le-coffre-resources/dist/Admin";
|
||||
import ObjectHydrate from "@Common/helpers/ObjectHydrate";
|
||||
import roleHandler from "@App/middlewares/RolesHandler";
|
||||
import authHandler from "@App/middlewares/AuthHandler";
|
||||
import EmailBuilder from "@Common/emails/EmailBuilder";
|
||||
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||
|
||||
@Controller()
|
||||
@Service()
|
||||
@ -23,7 +20,7 @@ export default class SubscriptionsController extends ApiController {
|
||||
/**
|
||||
* @description Get all subscriptions
|
||||
*/
|
||||
@Get("/api/v1/admin/subscriptions", [authHandler, roleHandler])
|
||||
@Get("/api/v1/admin/subscriptions", [authHandler, ruleHandler])
|
||||
protected async get(req: Request, response: Response) {
|
||||
try {
|
||||
//get query
|
||||
@ -51,9 +48,9 @@ export default class SubscriptionsController extends ApiController {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Get a specific documentType by uid
|
||||
* @description Get a specific subscription by uid
|
||||
*/
|
||||
@Get("/api/v1/admin/subscriptions/:uid", [authHandler, roleHandler])
|
||||
@Get("/api/v1/admin/subscriptions/:uid", [authHandler, ruleHandler])
|
||||
protected async getOneByUid(req: Request, response: Response) {
|
||||
try {
|
||||
const uid = req.params["uid"];
|
||||
@ -80,34 +77,10 @@ export default class SubscriptionsController extends ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @description Create a new documentType
|
||||
// */
|
||||
// @Post("/api/v1/admin/subscriptions", [authHandler, roleHandler])
|
||||
// protected async post(req: Request, response: Response) {
|
||||
// try {
|
||||
// //init Subscription resource with request body values
|
||||
// const subscriptionEntity = Subscription.hydrate<Subscription>(req.body);
|
||||
// //validate subscription
|
||||
// await validateOrReject(subscriptionEntity, { groups: ["createSubscription"], forbidUnknownValues: false });
|
||||
// //call service to get prisma entity
|
||||
// const subscriptionEntityCreated = await this.subscriptionsService.create(subscriptionEntity);
|
||||
// //Hydrate ressource with prisma entity
|
||||
// const subscription = Subscription.hydrate<Subscription>(subscriptionEntityCreated, {
|
||||
// strategy: "excludeAll",
|
||||
// });
|
||||
// //success
|
||||
// this.httpCreated(response, subscription);
|
||||
// } catch (error) {
|
||||
// this.httpInternalError(response, error);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @description Update a subscription
|
||||
*/
|
||||
@Put("/api/v1/admin/subscriptions/:uid", [authHandler, roleHandler])
|
||||
@Put("/api/v1/admin/subscriptions/:uid", [authHandler, ruleHandler])
|
||||
protected async put(req: Request, response: Response) {
|
||||
try {
|
||||
const uid = req.params["uid"];
|
||||
@ -147,7 +120,7 @@ export default class SubscriptionsController extends ApiController {
|
||||
* @description Invite collaborators to a subscription
|
||||
*/
|
||||
|
||||
@Post("/api/v1/admin/subscriptions/invite", [authHandler, roleHandler])
|
||||
@Post("/api/v1/admin/subscriptions/invite", [authHandler, ruleHandler])
|
||||
protected async inviteCollaborators(req: Request, response: Response) {
|
||||
try {
|
||||
//get email list from body
|
||||
@ -168,43 +141,4 @@ export default class SubscriptionsController extends ApiController {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @description Update a subscription seats
|
||||
// */
|
||||
// @Put("/api/v1/admin/subscriptions/:uid/seats", [authHandler, roleHandler])
|
||||
// protected async updateSubscriptionSeats(req: Request, response: Response) {
|
||||
// try {
|
||||
// const uid = req.params["uid"];
|
||||
// if (!uid) {
|
||||
// this.httpBadRequest(response, "No uid provided");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// const subscriptionFound = await this.subscriptionsService.getByUid(uid);
|
||||
|
||||
// if (!subscriptionFound) {
|
||||
// this.httpNotFoundRequest(response, "subscription not found");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// //init Subscription resource with request body values
|
||||
// const seatEntities = Seat.hydrateArray<Seat>(req.body);
|
||||
|
||||
// //call service to get prisma entity
|
||||
// const subscriptionEntityUpdated = await this.subscriptionsService.update(uid, subscriptionEntity);
|
||||
|
||||
// //Hydrate ressource with prisma entity
|
||||
// const subscription = Subscription.hydrate<Subscription>(subscriptionEntityUpdated, {
|
||||
// strategy: "excludeAll",
|
||||
// });
|
||||
|
||||
// //success
|
||||
// this.httpSuccess(response, subscription);
|
||||
|
||||
// } catch (error) {
|
||||
// this.httpInternalError(response, error);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ export default class UserController extends ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
if (userHydrated.role?.name === "admin") {
|
||||
if (userHydrated.role?.name === "admin" || userHydrated.role?.name === "super-admin") {
|
||||
isSubscribed = true;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import OfficerRibService from "@Services/common/OfficeRibService/OfficeRibServic
|
||||
import authHandler from "@App/middlewares/AuthHandler";
|
||||
import OfficesService from "@Services/notary/OfficesService/OfficesService";
|
||||
import { Office as OfficeResource } from "le-coffre-resources/dist/Notary";
|
||||
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||
|
||||
@Controller()
|
||||
@Service()
|
||||
@ -15,7 +16,7 @@ export default class OfficeRibController extends ApiController {
|
||||
super();
|
||||
}
|
||||
|
||||
@Get("/api/v1/notary/office/rib", [authHandler])
|
||||
@Get("/api/v1/notary/rib", [authHandler, ruleHandler])
|
||||
protected async getRibStream(req: Request, response: Response) {
|
||||
const officeId: string = req.body.user.office_Id;
|
||||
if (!officeId) throw new Error("No officeId provided");
|
||||
@ -43,7 +44,7 @@ export default class OfficeRibController extends ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@Post("/api/v1/notary/office/rib", [authHandler])
|
||||
@Post("/api/v1/notary/rib", [authHandler, ruleHandler])
|
||||
protected async post(req: Request, response: Response) {
|
||||
try {
|
||||
const officeId: string = req.body.user.office_Id;
|
||||
@ -82,7 +83,7 @@ export default class OfficeRibController extends ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@Delete("/api/v1/notary/office/rib", [authHandler])
|
||||
@Delete("/api/v1/notary/rib", [authHandler, ruleHandler])
|
||||
protected async delete(req: Request, response: Response) {
|
||||
try {
|
||||
const officeId: string = req.body.user.office_Id;
|
||||
|
@ -527,28 +527,28 @@ export default async function main() {
|
||||
label: "Lecture des utilisateurs",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET offices",
|
||||
label: "Afficher des offices",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET customers",
|
||||
label: "Afficher des clients",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET deeds",
|
||||
label: "Voir des types d'acte",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET deed-types",
|
||||
@ -562,7 +562,7 @@ export default async function main() {
|
||||
label: "Afficher des documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET document-types",
|
||||
@ -576,112 +576,112 @@ export default async function main() {
|
||||
label: "Lecture des fichiers",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET folders",
|
||||
label: "Afficher les dossiers",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET roles",
|
||||
label: "Afficher les rôles",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET rules",
|
||||
label: "Afficher les droits",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET office-roles",
|
||||
label: "Lecture des rôles d'office",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "POST deeds",
|
||||
label: "Créer un template de type d'acte",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "PUT deeds",
|
||||
label: "Modifier un type d'acte",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "DELETE deeds",
|
||||
label: "Supprimer des types d'actes",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "POST folders",
|
||||
label: "Créer un dossier",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "PUT folders",
|
||||
label: "Modifier des dossiers",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "DELETE folders",
|
||||
label: "Supprimer un dossier vide",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "POST documents",
|
||||
label: "Demander des documents à un client",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "PUT documents",
|
||||
label: "Valider des documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "DELETE documents",
|
||||
label: "Supprimer un document demandé",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "POST customers",
|
||||
label: "Créer des clients",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "PUT customers",
|
||||
label: "Modifier des clients",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "DELETE customers",
|
||||
@ -695,56 +695,56 @@ export default async function main() {
|
||||
label: "Ancrer un dossier",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "GET anchors",
|
||||
label: "Vérifier l'ancrage un dossier",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "global",
|
||||
},
|
||||
{
|
||||
name: "POST deed-types",
|
||||
label: "Création des types d'actes",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "admin",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "PUT deed-types",
|
||||
label: "Modification des types d'actes",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "admin",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "DELETE deed-types",
|
||||
label: "Suppression des types d'actes",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "admin",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "POST document-types",
|
||||
label: "Création des types de documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "admin",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "PUT document-types",
|
||||
label: "Modification des types de documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "admin",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "DELETE document-types",
|
||||
label: "Suppression des types de documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "admin",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "POST office-roles",
|
||||
@ -793,54 +793,83 @@ export default async function main() {
|
||||
label: "Editer le RIB de l'office",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "GET rib",
|
||||
label: "Lire le RIB de l'office",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "POST rib",
|
||||
label: "Déposer le RIB de l'office",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "DELETE rib",
|
||||
label: "Supprimer le RIB de l'office",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "GET subscriptions",
|
||||
label: "Récupérer les abonnements",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "POST subscriptions",
|
||||
label: "Inviter un collaborateur à l'abonnement",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "PUT subscriptions",
|
||||
label: "Modifier l'abonnement",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "GET stripe",
|
||||
label: "Gérer l'abonnement de l'office",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
{
|
||||
name: "POST stripe",
|
||||
label: "Payer un abonnement",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
namespace: "notary",
|
||||
namespace: "collaborator",
|
||||
},
|
||||
];
|
||||
|
||||
const rulesGroups = [
|
||||
{
|
||||
name: "Gestion des types d'actes et des documents",
|
||||
name: "Gestion des matrices d'actes et des documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
rules: [
|
||||
"POST deeds",
|
||||
"PUT deeds",
|
||||
"DELETE deeds",
|
||||
"GET document-types",
|
||||
"DELETE deed-types",
|
||||
"PUT deed-types",
|
||||
"DELETE document-types",
|
||||
"GET deed-types",
|
||||
"POST document-types",
|
||||
"POST deed-types",
|
||||
"PUT document-types",
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -856,18 +885,22 @@ export default async function main() {
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Gestion du RIB",
|
||||
name: "Intégration du RIB",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
rules : [
|
||||
"PUT rib"
|
||||
"PUT rib",
|
||||
"GET rib",
|
||||
"POST rib",
|
||||
"DELETE rib",
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
const collaboratorRules = rules.filter((rule) => rule.namespace === "collaborator");
|
||||
const notaryRules = [...collaboratorRules, ...rules.filter((rule) => rule.namespace === "notary")];
|
||||
const adminRules = [...notaryRules, ...rules.filter((rule) => rule.namespace === "admin")];
|
||||
const globalRules = [...notaryRules, ...rules.filter((rule) => rule.namespace === "global")];
|
||||
const adminRules = [...globalRules, ...rules.filter((rule) => rule.namespace === "admin")];
|
||||
const superAdminRules = [...adminRules, ...rules.filter((rule) => rule.namespace === "super-admin")];
|
||||
|
||||
const roles: Role[] = [
|
||||
@ -907,14 +940,14 @@ export default async function main() {
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
office: offices[0]!,
|
||||
rules: notaryRules,
|
||||
rules: globalRules,
|
||||
},
|
||||
{
|
||||
name: "Collaborateur",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
office: offices[0]!,
|
||||
rules: notaryRules,
|
||||
rules: globalRules,
|
||||
},
|
||||
];
|
||||
|
||||
|
2194
src/common/databases/seeders/seederOld.ts
Normal file
2194
src/common/databases/seeders/seederOld.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -132,7 +132,7 @@ export default class EmailBuilder {
|
||||
nbTrySend: null,
|
||||
lastTrySendDate: null,
|
||||
});
|
||||
this.mailchimpService.sendEmails();
|
||||
// this.mailchimpService.sendEmails();
|
||||
});
|
||||
|
||||
|
||||
|
@ -38,54 +38,8 @@ export default class StripeService {
|
||||
|
||||
}
|
||||
|
||||
public async createCheckoutSessionUpdate(uid: string, subscription: Subscription) {
|
||||
|
||||
|
||||
|
||||
// return this.client.checkout.sessions.create({
|
||||
// mode: "payment",
|
||||
// payment_method_types: ["card", "paypal"],
|
||||
// billing_address_collection: "auto",
|
||||
// success_url: this.variables.APP_HOST + "/subscription/success",
|
||||
// cancel_url: this.variables.APP_HOST + "/subscription/error",
|
||||
// metadata: {
|
||||
// subscription: JSON.stringify(subscription),
|
||||
// },
|
||||
// });
|
||||
|
||||
// const priceId =
|
||||
// subscription.type === "STANDARD"
|
||||
// ? this.variables.STRIPE_STANDARD_SUBSCRIPTION_PRICE_ID
|
||||
// : this.variables.STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID;
|
||||
|
||||
// return this.client.checkout.sessions.create({
|
||||
// mode: "subscription",
|
||||
// payment_method_types: ["card", "paypal"],
|
||||
// billing_address_collection: "auto",
|
||||
// line_items: [
|
||||
// {
|
||||
// price: priceId,
|
||||
// quantity: subscription.type === "STANDARD" ? subscription.nb_seats : 1,
|
||||
// },
|
||||
// ],
|
||||
// success_url: this.variables.APP_HOST + "/subscription/success",
|
||||
// cancel_url: this.variables.APP_HOST + "/subscription/error",
|
||||
// metadata: {
|
||||
// subscription: JSON.stringify(subscription),
|
||||
// },
|
||||
// });
|
||||
// const subscriptions = await this.client.subscriptions.retrieve(uid);
|
||||
// const itemId = subscriptions.items.data[0]?.id;
|
||||
|
||||
// return await this.client.subscriptions.update(uid, {
|
||||
// items: [
|
||||
// {
|
||||
// id: itemId,
|
||||
// price: priceId,
|
||||
// quantity: subscription.nb_seats,
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
public async getStripeSubscriptionByUid(subscriptionId: string) {
|
||||
return await this.client.subscriptions.retrieve(subscriptionId);
|
||||
}
|
||||
|
||||
public async createClientPortalSession(subscriptionId: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user