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
|
uses: scaleway/action-scw@v0
|
||||||
- name: Get container ID
|
- name: Get container ID
|
||||||
run: |
|
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:
|
env:
|
||||||
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}
|
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}
|
||||||
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
|
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
|
||||||
|
@ -29,7 +29,7 @@ export default class OfficeRolesController extends ApiController {
|
|||||||
let query: Prisma.OfficeRolesFindManyArgs = {};
|
let query: Prisma.OfficeRolesFindManyArgs = {};
|
||||||
if (req.query["q"]) {
|
if (req.query["q"]) {
|
||||||
query = JSON.parse(req.query["q"] as string);
|
query = JSON.parse(req.query["q"] as string);
|
||||||
if(query.where?.uid) {
|
if (query.where?.uid) {
|
||||||
this.httpBadRequest(response, "You can't filter by uid");
|
this.httpBadRequest(response, "You can't filter by uid");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -75,6 +75,17 @@ export default class OfficeRolesController extends ApiController {
|
|||||||
//init IOfficeRole resource with request body values
|
//init IOfficeRole resource with request body values
|
||||||
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
||||||
|
|
||||||
|
const allRules = await this.rulesService.get({
|
||||||
|
where: {
|
||||||
|
OR: [
|
||||||
|
{
|
||||||
|
namespace: "global",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
officeRoleEntity.rules = allRules;
|
||||||
//validate officeRole
|
//validate officeRole
|
||||||
await validateOrReject(officeRoleEntity, { groups: ["createOfficeRole"] });
|
await validateOrReject(officeRoleEntity, { groups: ["createOfficeRole"] });
|
||||||
|
|
||||||
@ -114,23 +125,28 @@ 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: {
|
||||||
OR: [
|
namespace: "global",
|
||||||
{
|
},
|
||||||
namespace: "notary",
|
});
|
||||||
},
|
|
||||||
{
|
const specificRules = await this.rulesService.get({
|
||||||
namespace: "collaborator",
|
where: {
|
||||||
},
|
namespace: "collaborator",
|
||||||
],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
req.body.rules = req.body.rules.filter((rule: any) => {
|
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;
|
return ruleFound;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
req.body.rules = req.body.rules.concat(allRules);
|
||||||
}
|
}
|
||||||
//init IOfficeRole resource with request body values
|
//init IOfficeRole resource with request body values
|
||||||
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import authHandler from "@App/middlewares/AuthHandler";
|
import authHandler from "@App/middlewares/AuthHandler";
|
||||||
|
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||||
// import roleHandler from "@App/middlewares/RolesHandler";
|
// import roleHandler from "@App/middlewares/RolesHandler";
|
||||||
import ApiController from "@Common/system/controller-pattern/ApiController";
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
import { Controller, Get, Post} from "@ControllerPattern/index";
|
import { Controller, Get, Post} from "@ControllerPattern/index";
|
||||||
@ -18,7 +19,7 @@ export default class StripeController extends ApiController {
|
|||||||
/**
|
/**
|
||||||
* @description Create a new checkout session
|
* @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) {
|
protected async createStripeSubscriptionCheckout(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
const officeId: string = req.body.user.office_Id;
|
const officeId: string = req.body.user.office_Id;
|
||||||
@ -41,33 +42,25 @@ export default class StripeController extends ApiController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Put("/api/v1/admin/stripe/:uid")
|
@Get("/api/v1/admin/stripe/:uid")
|
||||||
// protected async createStripeSubscriptionUpdateCheckout(req: Request, response: Response) {
|
protected async getStripeSubscriptionByUid(req: Request, response: Response) {
|
||||||
// try {
|
try {
|
||||||
// const uid = req.params["uid"];
|
const uid = req.params["uid"];
|
||||||
// if (!uid) {
|
if (!uid) {
|
||||||
// this.httpBadRequest(response, "No uid provided");
|
this.httpBadRequest(response, "No uid provided");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// const officeId: string = req.body.user.office_Id;
|
|
||||||
// //add office id to request body
|
|
||||||
// req.body.office = { uid: officeId };
|
|
||||||
|
|
||||||
// //init Subscription resource with request body values
|
const stripe_subscription = await this.stripeService.getStripeSubscriptionByUid(uid);
|
||||||
// const subscriptionEntity = Subscription.hydrate<Subscription>(req.body, { strategy: "excludeAll" });
|
|
||||||
|
|
||||||
// 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);
|
@Get("/api/v1/admin/stripe/:uid/client-portal", [authHandler, ruleHandler])
|
||||||
|
|
||||||
// this.httpCreated(response, stripeSession);
|
|
||||||
// } catch (error) {
|
|
||||||
// this.httpInternalError(response, error);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Get("/api/v1/admin/stripe/:uid", [authHandler])
|
|
||||||
protected async getClientPortalSession(req: Request, response: Response) {
|
protected async getClientPortalSession(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
const uid = req.params["uid"];
|
const uid = req.params["uid"];
|
||||||
|
@ -2,16 +2,13 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index";
|
|||||||
import { Response, Request } from "express";
|
import { Response, Request } from "express";
|
||||||
import ApiController from "@Common/system/controller-pattern/ApiController";
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
import { Service } from "typedi";
|
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 { Prisma } from "@prisma/client";
|
||||||
import SubscriptionsService from "@Services/admin/SubscriptionsService/SubscriptionsService.ts";
|
import SubscriptionsService from "@Services/admin/SubscriptionsService/SubscriptionsService.ts";
|
||||||
import { Subscription } from "le-coffre-resources/dist/Admin";
|
import { Subscription } from "le-coffre-resources/dist/Admin";
|
||||||
import ObjectHydrate from "@Common/helpers/ObjectHydrate";
|
import ObjectHydrate from "@Common/helpers/ObjectHydrate";
|
||||||
import roleHandler from "@App/middlewares/RolesHandler";
|
|
||||||
import authHandler from "@App/middlewares/AuthHandler";
|
import authHandler from "@App/middlewares/AuthHandler";
|
||||||
import EmailBuilder from "@Common/emails/EmailBuilder";
|
import EmailBuilder from "@Common/emails/EmailBuilder";
|
||||||
|
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@Service()
|
@Service()
|
||||||
@ -23,7 +20,7 @@ export default class SubscriptionsController extends ApiController {
|
|||||||
/**
|
/**
|
||||||
* @description Get all subscriptions
|
* @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) {
|
protected async get(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
//get query
|
//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) {
|
protected async getOneByUid(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
const uid = req.params["uid"];
|
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
|
* @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) {
|
protected async put(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
const uid = req.params["uid"];
|
const uid = req.params["uid"];
|
||||||
@ -147,7 +120,7 @@ export default class SubscriptionsController extends ApiController {
|
|||||||
* @description Invite collaborators to a subscription
|
* @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) {
|
protected async inviteCollaborators(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
//get email list from body
|
//get email list from body
|
||||||
@ -168,43 +141,4 @@ export default class SubscriptionsController extends ApiController {
|
|||||||
return;
|
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;
|
isSubscribed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import OfficerRibService from "@Services/common/OfficeRibService/OfficeRibServic
|
|||||||
import authHandler from "@App/middlewares/AuthHandler";
|
import authHandler from "@App/middlewares/AuthHandler";
|
||||||
import OfficesService from "@Services/notary/OfficesService/OfficesService";
|
import OfficesService from "@Services/notary/OfficesService/OfficesService";
|
||||||
import { Office as OfficeResource } from "le-coffre-resources/dist/Notary";
|
import { Office as OfficeResource } from "le-coffre-resources/dist/Notary";
|
||||||
|
import ruleHandler from "@App/middlewares/RulesHandler";
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@Service()
|
@Service()
|
||||||
@ -15,7 +16,7 @@ export default class OfficeRibController extends ApiController {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("/api/v1/notary/office/rib", [authHandler])
|
@Get("/api/v1/notary/rib", [authHandler, ruleHandler])
|
||||||
protected async getRibStream(req: Request, response: Response) {
|
protected async getRibStream(req: Request, response: Response) {
|
||||||
const officeId: string = req.body.user.office_Id;
|
const officeId: string = req.body.user.office_Id;
|
||||||
if (!officeId) throw new Error("No officeId provided");
|
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) {
|
protected async post(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
const officeId: string = req.body.user.office_Id;
|
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) {
|
protected async delete(req: Request, response: Response) {
|
||||||
try {
|
try {
|
||||||
const officeId: string = req.body.user.office_Id;
|
const officeId: string = req.body.user.office_Id;
|
||||||
|
@ -527,28 +527,28 @@ export default async function main() {
|
|||||||
label: "Lecture des utilisateurs",
|
label: "Lecture des utilisateurs",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET offices",
|
name: "GET offices",
|
||||||
label: "Afficher des offices",
|
label: "Afficher des offices",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET customers",
|
name: "GET customers",
|
||||||
label: "Afficher des clients",
|
label: "Afficher des clients",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET deeds",
|
name: "GET deeds",
|
||||||
label: "Voir des types d'acte",
|
label: "Voir des types d'acte",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET deed-types",
|
name: "GET deed-types",
|
||||||
@ -562,7 +562,7 @@ export default async function main() {
|
|||||||
label: "Afficher des documents",
|
label: "Afficher des documents",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET document-types",
|
name: "GET document-types",
|
||||||
@ -576,112 +576,112 @@ export default async function main() {
|
|||||||
label: "Lecture des fichiers",
|
label: "Lecture des fichiers",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET folders",
|
name: "GET folders",
|
||||||
label: "Afficher les dossiers",
|
label: "Afficher les dossiers",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET roles",
|
name: "GET roles",
|
||||||
label: "Afficher les rôles",
|
label: "Afficher les rôles",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET rules",
|
name: "GET rules",
|
||||||
label: "Afficher les droits",
|
label: "Afficher les droits",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET office-roles",
|
name: "GET office-roles",
|
||||||
label: "Lecture des rôles d'office",
|
label: "Lecture des rôles d'office",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "collaborator",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST deeds",
|
name: "POST deeds",
|
||||||
label: "Créer un template de type d'acte",
|
label: "Créer un template de type d'acte",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT deeds",
|
name: "PUT deeds",
|
||||||
label: "Modifier un type d'acte",
|
label: "Modifier un type d'acte",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE deeds",
|
name: "DELETE deeds",
|
||||||
label: "Supprimer des types d'actes",
|
label: "Supprimer des types d'actes",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST folders",
|
name: "POST folders",
|
||||||
label: "Créer un dossier",
|
label: "Créer un dossier",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT folders",
|
name: "PUT folders",
|
||||||
label: "Modifier des dossiers",
|
label: "Modifier des dossiers",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE folders",
|
name: "DELETE folders",
|
||||||
label: "Supprimer un dossier vide",
|
label: "Supprimer un dossier vide",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST documents",
|
name: "POST documents",
|
||||||
label: "Demander des documents à un client",
|
label: "Demander des documents à un client",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT documents",
|
name: "PUT documents",
|
||||||
label: "Valider des documents",
|
label: "Valider des documents",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE documents",
|
name: "DELETE documents",
|
||||||
label: "Supprimer un document demandé",
|
label: "Supprimer un document demandé",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST customers",
|
name: "POST customers",
|
||||||
label: "Créer des clients",
|
label: "Créer des clients",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT customers",
|
name: "PUT customers",
|
||||||
label: "Modifier des clients",
|
label: "Modifier des clients",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE customers",
|
name: "DELETE customers",
|
||||||
@ -695,56 +695,56 @@ export default async function main() {
|
|||||||
label: "Ancrer un dossier",
|
label: "Ancrer un dossier",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET anchors",
|
name: "GET anchors",
|
||||||
label: "Vérifier l'ancrage un dossier",
|
label: "Vérifier l'ancrage un dossier",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "global",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST deed-types",
|
name: "POST deed-types",
|
||||||
label: "Création des types d'actes",
|
label: "Création des types d'actes",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "admin",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT deed-types",
|
name: "PUT deed-types",
|
||||||
label: "Modification des types d'actes",
|
label: "Modification des types d'actes",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "admin",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE deed-types",
|
name: "DELETE deed-types",
|
||||||
label: "Suppression des types d'actes",
|
label: "Suppression des types d'actes",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "admin",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST document-types",
|
name: "POST document-types",
|
||||||
label: "Création des types de documents",
|
label: "Création des types de documents",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "admin",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT document-types",
|
name: "PUT document-types",
|
||||||
label: "Modification des types de documents",
|
label: "Modification des types de documents",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "admin",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE document-types",
|
name: "DELETE document-types",
|
||||||
label: "Suppression des types de documents",
|
label: "Suppression des types de documents",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "admin",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST office-roles",
|
name: "POST office-roles",
|
||||||
@ -793,54 +793,83 @@ export default async function main() {
|
|||||||
label: "Editer le RIB de l'office",
|
label: "Editer le RIB de l'office",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_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",
|
name: "GET subscriptions",
|
||||||
label: "Récupérer les abonnements",
|
label: "Récupérer les abonnements",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST subscriptions",
|
name: "POST subscriptions",
|
||||||
label: "Inviter un collaborateur à l'abonnement",
|
label: "Inviter un collaborateur à l'abonnement",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PUT subscriptions",
|
name: "PUT subscriptions",
|
||||||
label: "Modifier l'abonnement",
|
label: "Modifier l'abonnement",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GET stripe",
|
name: "GET stripe",
|
||||||
label: "Gérer l'abonnement de l'office",
|
label: "Gérer l'abonnement de l'office",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "POST stripe",
|
name: "POST stripe",
|
||||||
label: "Payer un abonnement",
|
label: "Payer un abonnement",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
namespace: "notary",
|
namespace: "collaborator",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const rulesGroups = [
|
const rulesGroups = [
|
||||||
{
|
{
|
||||||
name: "Gestion des types d'actes et des documents",
|
name: "Gestion des matrices d'actes et des documents",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
rules: [
|
rules: [
|
||||||
"POST deeds",
|
"POST deeds",
|
||||||
"PUT deeds",
|
"PUT deeds",
|
||||||
"DELETE 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(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
rules : [
|
rules : [
|
||||||
"PUT rib"
|
"PUT rib",
|
||||||
|
"GET rib",
|
||||||
|
"POST rib",
|
||||||
|
"DELETE rib",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const collaboratorRules = rules.filter((rule) => rule.namespace === "collaborator");
|
const collaboratorRules = rules.filter((rule) => rule.namespace === "collaborator");
|
||||||
const notaryRules = [...collaboratorRules, ...rules.filter((rule) => rule.namespace === "notary")];
|
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 superAdminRules = [...adminRules, ...rules.filter((rule) => rule.namespace === "super-admin")];
|
||||||
|
|
||||||
const roles: Role[] = [
|
const roles: Role[] = [
|
||||||
@ -907,14 +940,14 @@ export default async function main() {
|
|||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
office: offices[0]!,
|
office: offices[0]!,
|
||||||
rules: notaryRules,
|
rules: globalRules,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Collaborateur",
|
name: "Collaborateur",
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
office: offices[0]!,
|
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,
|
nbTrySend: null,
|
||||||
lastTrySendDate: null,
|
lastTrySendDate: null,
|
||||||
});
|
});
|
||||||
this.mailchimpService.sendEmails();
|
// this.mailchimpService.sendEmails();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,54 +38,8 @@ export default class StripeService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createCheckoutSessionUpdate(uid: string, subscription: Subscription) {
|
public async getStripeSubscriptionByUid(subscriptionId: string) {
|
||||||
|
return await this.client.subscriptions.retrieve(subscriptionId);
|
||||||
|
|
||||||
|
|
||||||
// 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 createClientPortalSession(subscriptionId: string) {
|
public async createClientPortalSession(subscriptionId: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user