delete explicit relations for models
This commit is contained in:
parent
037976a1e6
commit
9a686be8ba
@ -49,7 +49,6 @@ export default class UserController extends ApiController {
|
||||
//success
|
||||
this.httpSuccess(response, { accessToken, refreshToken });
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.httpInternalError(response);
|
||||
return;
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ export default class RulesController extends ApiController {
|
||||
const ruleEntity = Rule.hydrate<Rule>(req.body);
|
||||
|
||||
//validate rule
|
||||
await validateOrReject(ruleEntity, { groups: ["createRule"] });
|
||||
|
||||
await validateOrReject(ruleEntity, {groups: ["createRule"]});
|
||||
|
||||
//call service to get prisma entity
|
||||
const ruleEntityCreated = await this.rulesService.create(ruleEntity);
|
||||
|
||||
|
@ -11,7 +11,7 @@ import DocumentTypesController from "./api/super-admin/DocumentTypesController";
|
||||
import IdNotUserController from "./api/idnot/UserController";
|
||||
import DocumentsControllerCustomer from "./api/customer/DocumentsController";
|
||||
import FilesController from "./api/super-admin/FilesController";
|
||||
import RulesController from "./api/super-admin/RolesController";
|
||||
import RulesController from "./api/super-admin/RulesController";
|
||||
import RolesController from "./api/super-admin/RolesController";
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@ export default function authHandler(req: Request, response: Response, next: Next
|
||||
response.sendStatus(HttpCodes.UNAUTHORIZED);
|
||||
return;
|
||||
}
|
||||
console.log(userPayload);
|
||||
req.body.user = userPayload
|
||||
next();
|
||||
});
|
||||
|
144
src/common/databases/migrations/20230628100711_v7/migration.sql
Normal file
144
src/common/databases/migrations/20230628100711_v7/migration.sql
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `deed_has_document_types` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `deed_type_has_document_types` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `office_folder_has_customers` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `office_folder_has_stakeholder` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `user_has_notifications` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_deed_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_document_type_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_deed_type_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_document_type_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_customer_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_office_folder_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_office_folder_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "user_has_notifications" DROP CONSTRAINT "user_has_notifications_notification_uid_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "user_has_notifications" DROP CONSTRAINT "user_has_notifications_user_uid_fkey";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "deed_has_document_types";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "deed_type_has_document_types";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "office_folder_has_customers";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "office_folder_has_stakeholder";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "user_has_notifications";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_OfficeFolderHasCustomers" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_UserHasNotifications" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_OfficeFolderHasStakeholders" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_DeedHasDocumentTypes" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_DeedTypeHasDocumentTypes" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_OfficeFolderHasCustomers_AB_unique" ON "_OfficeFolderHasCustomers"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_OfficeFolderHasCustomers_B_index" ON "_OfficeFolderHasCustomers"("B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_UserHasNotifications_AB_unique" ON "_UserHasNotifications"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_UserHasNotifications_B_index" ON "_UserHasNotifications"("B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_OfficeFolderHasStakeholders_AB_unique" ON "_OfficeFolderHasStakeholders"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_OfficeFolderHasStakeholders_B_index" ON "_OfficeFolderHasStakeholders"("B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_DeedHasDocumentTypes_AB_unique" ON "_DeedHasDocumentTypes"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_DeedHasDocumentTypes_B_index" ON "_DeedHasDocumentTypes"("B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_DeedTypeHasDocumentTypes_AB_unique" ON "_DeedTypeHasDocumentTypes"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_DeedTypeHasDocumentTypes_B_index" ON "_DeedTypeHasDocumentTypes"("B");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_OfficeFolderHasCustomers" ADD CONSTRAINT "_OfficeFolderHasCustomers_A_fkey" FOREIGN KEY ("A") REFERENCES "customers"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_OfficeFolderHasCustomers" ADD CONSTRAINT "_OfficeFolderHasCustomers_B_fkey" FOREIGN KEY ("B") REFERENCES "office_folders"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_UserHasNotifications" ADD CONSTRAINT "_UserHasNotifications_A_fkey" FOREIGN KEY ("A") REFERENCES "notifications"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_UserHasNotifications" ADD CONSTRAINT "_UserHasNotifications_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_OfficeFolderHasStakeholders" ADD CONSTRAINT "_OfficeFolderHasStakeholders_A_fkey" FOREIGN KEY ("A") REFERENCES "office_folders"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_OfficeFolderHasStakeholders" ADD CONSTRAINT "_OfficeFolderHasStakeholders_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_DeedHasDocumentTypes" ADD CONSTRAINT "_DeedHasDocumentTypes_A_fkey" FOREIGN KEY ("A") REFERENCES "deed"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_DeedHasDocumentTypes" ADD CONSTRAINT "_DeedHasDocumentTypes_B_fkey" FOREIGN KEY ("B") REFERENCES "document_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_DeedTypeHasDocumentTypes" ADD CONSTRAINT "_DeedTypeHasDocumentTypes_A_fkey" FOREIGN KEY ("A") REFERENCES "deed_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_DeedTypeHasDocumentTypes" ADD CONSTRAINT "_DeedTypeHasDocumentTypes_B_fkey" FOREIGN KEY ("B") REFERENCES "document_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -50,20 +50,20 @@ model Contacts {
|
||||
}
|
||||
|
||||
model Users {
|
||||
uid String @id @unique @default(uuid()) @map("uid")
|
||||
idNot String @unique @db.VarChar(255)
|
||||
contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade)
|
||||
contact_uid String @unique @db.VarChar(255)
|
||||
role Roles @relation(fields: [roles_uid], references: [uid], onDelete: Cascade)
|
||||
roles_uid String @db.VarChar(255)
|
||||
office_role OfficeRoles? @relation(fields: [office_role_uid], references: [uid], onDelete: Cascade)
|
||||
office_role_uid String? @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
office_membership Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
user_has_notifications UserHasNotifications[]
|
||||
office_folder_has_stakeholder OfficeFolderHasStakeholders[]
|
||||
uid String @id @unique @default(uuid()) @map("uid")
|
||||
idNot String @unique @db.VarChar(255)
|
||||
contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade)
|
||||
contact_uid String @unique @db.VarChar(255)
|
||||
role Roles @relation(fields: [roles_uid], references: [uid], onDelete: Cascade)
|
||||
roles_uid String @db.VarChar(255)
|
||||
office_role OfficeRoles? @relation(fields: [office_role_uid], references: [uid], onDelete: Cascade)
|
||||
office_role_uid String? @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
office_membership Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
notifications Notifications[] @relation("UserHasNotifications")
|
||||
office_folders OfficeFolders[] @relation("OfficeFolderHasStakeholders")
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@ -82,96 +82,56 @@ model Offices {
|
||||
users Users[]
|
||||
office_folders OfficeFolders[]
|
||||
document_types DocumentTypes[]
|
||||
OfficeRoles OfficeRoles[]
|
||||
office_roles OfficeRoles[]
|
||||
|
||||
@@map("offices")
|
||||
}
|
||||
|
||||
model Customers {
|
||||
uid String @id @unique @default(uuid())
|
||||
status ECustomerStatus @default(PENDING)
|
||||
contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade)
|
||||
contact_uid String @unique @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
office_folder_has_customers OfficeFolderHasCustomers[]
|
||||
documents Documents[]
|
||||
uid String @id @unique @default(uuid())
|
||||
status ECustomerStatus @default(PENDING)
|
||||
contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade)
|
||||
contact_uid String @unique @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
office_folders OfficeFolders[] @relation("OfficeFolderHasCustomers")
|
||||
documents Documents[]
|
||||
|
||||
@@map("customers")
|
||||
}
|
||||
|
||||
model UserHasNotifications {
|
||||
uid String @id @unique @default(uuid())
|
||||
user Users @relation(fields: [user_uid], references: [uid])
|
||||
user_uid String @db.VarChar(255)
|
||||
notification Notifications @relation(fields: [notification_uid], references: [uid], onDelete: Cascade)
|
||||
notification_uid String @db.VarChar(255)
|
||||
notification_status ENotificationStatus @default(UNREAD)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@unique([notification_uid, user_uid])
|
||||
@@map("user_has_notifications")
|
||||
}
|
||||
|
||||
model Notifications {
|
||||
uid String @id @unique @default(uuid())
|
||||
message String @db.VarChar(255)
|
||||
redirection_url String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
user_has_notifications UserHasNotifications[]
|
||||
uid String @id @unique @default(uuid())
|
||||
message String @db.VarChar(255)
|
||||
redirection_url String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
users Users[] @relation("UserHasNotifications")
|
||||
|
||||
@@map("notifications")
|
||||
}
|
||||
|
||||
model OfficeFolders {
|
||||
uid String @id @unique @default(uuid())
|
||||
folder_number String @db.VarChar(255)
|
||||
name String @db.VarChar(255)
|
||||
description String? @db.VarChar(255)
|
||||
archived_description String? @db.VarChar(255)
|
||||
status EFolderStatus @default(LIVE)
|
||||
deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade)
|
||||
deed_uid String @unique @db.VarChar(255)
|
||||
office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
office_folder_has_customers OfficeFolderHasCustomers[]
|
||||
office_folder_has_stakeholder OfficeFolderHasStakeholders[]
|
||||
documents Documents[]
|
||||
uid String @id @unique @default(uuid())
|
||||
folder_number String @db.VarChar(255)
|
||||
name String @db.VarChar(255)
|
||||
description String? @db.VarChar(255)
|
||||
archived_description String? @db.VarChar(255)
|
||||
status EFolderStatus @default(LIVE)
|
||||
deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade)
|
||||
deed_uid String @unique @db.VarChar(255)
|
||||
office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
stakeholders Users[] @relation("OfficeFolderHasStakeholders")
|
||||
customers Customers[] @relation("OfficeFolderHasCustomers")
|
||||
documents Documents[]
|
||||
|
||||
@@unique([folder_number, office_uid])
|
||||
@@map("office_folders")
|
||||
}
|
||||
|
||||
model OfficeFolderHasCustomers {
|
||||
uid String @id @unique @default(uuid())
|
||||
customer Customers @relation(fields: [customer_uid], references: [uid], onDelete: Cascade)
|
||||
customer_uid String @db.VarChar(255)
|
||||
office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade)
|
||||
office_folder_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@unique([office_folder_uid, customer_uid])
|
||||
@@map("office_folder_has_customers")
|
||||
}
|
||||
|
||||
model OfficeFolderHasStakeholders {
|
||||
uid String @id @unique @default(uuid())
|
||||
office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade)
|
||||
office_folder_uid String @db.VarChar(255)
|
||||
user_stakeholder Users @relation(fields: [user_stakeholder_uid], references: [uid], onDelete: Cascade)
|
||||
user_stakeholder_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@unique([office_folder_uid, user_stakeholder_uid])
|
||||
@@map("office_folder_has_stakeholder")
|
||||
}
|
||||
|
||||
model Documents {
|
||||
uid String @id @unique @default(uuid())
|
||||
document_status EDocumentStatus @default(ASKED)
|
||||
@ -230,77 +190,51 @@ model BlockchainAnchors {
|
||||
}
|
||||
|
||||
model DocumentTypes {
|
||||
uid String @id @unique @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
public_description String @db.VarChar(255)
|
||||
private_description String? @db.VarChar(255)
|
||||
office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
archived_at DateTime?
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
documents Documents[]
|
||||
deed_has_document_types DeedHasDocumentTypes[]
|
||||
deed_type_has_document_types DeedTypeHasDocumentTypes[]
|
||||
uid String @id @unique @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
public_description String @db.VarChar(255)
|
||||
private_description String? @db.VarChar(255)
|
||||
office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
archived_at DateTime?
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
documents Documents[]
|
||||
deeds Deeds[] @relation("DeedHasDocumentTypes")
|
||||
deed_type DeedTypes[] @relation("DeedTypeHasDocumentTypes")
|
||||
|
||||
@@unique([name, office_uid])
|
||||
@@map("document_types")
|
||||
}
|
||||
|
||||
model DeedHasDocumentTypes {
|
||||
uid String @id @unique @default(uuid())
|
||||
document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade)
|
||||
document_type_uid String @db.VarChar(255)
|
||||
deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade)
|
||||
deed_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@unique([deed_uid, document_type_uid])
|
||||
@@map("deed_has_document_types")
|
||||
}
|
||||
|
||||
model Deeds {
|
||||
uid String @id @unique @default(uuid())
|
||||
deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade)
|
||||
deed_type_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
deed_has_document_types DeedHasDocumentTypes[]
|
||||
office_folder OfficeFolders?
|
||||
uid String @id @unique @default(uuid())
|
||||
deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade)
|
||||
deed_type_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
document_types DocumentTypes[] @relation("DeedHasDocumentTypes")
|
||||
office_folder OfficeFolders?
|
||||
|
||||
@@map("deed")
|
||||
}
|
||||
|
||||
model DeedTypes {
|
||||
uid String @id @unique @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
description String @db.VarChar(255)
|
||||
archived_at DateTime?
|
||||
office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
deed Deeds[]
|
||||
deed_type_has_document_types DeedTypeHasDocumentTypes[]
|
||||
uid String @id @unique @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
description String @db.VarChar(255)
|
||||
archived_at DateTime?
|
||||
office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade)
|
||||
office_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
deed Deeds[]
|
||||
document_types DocumentTypes[] @relation("DeedTypeHasDocumentTypes")
|
||||
|
||||
@@unique([name, office_uid])
|
||||
@@map("deed_types")
|
||||
}
|
||||
|
||||
model DeedTypeHasDocumentTypes {
|
||||
uid String @id @unique @default(uuid())
|
||||
document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade)
|
||||
document_type_uid String @db.VarChar(255)
|
||||
deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade)
|
||||
deed_type_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@unique([deed_type_uid, document_type_uid])
|
||||
@@map("deed_type_has_document_types")
|
||||
}
|
||||
|
||||
model Roles {
|
||||
uid String @id @unique @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
@ -336,30 +270,6 @@ model Rules {
|
||||
@@map("rules")
|
||||
}
|
||||
|
||||
// model RolesHasRules {
|
||||
// uid String @id @unique @default(uuid())
|
||||
// role Roles @relation(fields: [role_uid], references: [uid], onDelete: Cascade)
|
||||
// role_uid String @db.VarChar(255)
|
||||
// rule Rules @relation(fields: [rule_uid], references: [uid], onDelete: Cascade)
|
||||
// rule_uid String @db.VarChar(255)
|
||||
// created_at DateTime? @default(now())
|
||||
// updated_at DateTime? @updatedAt
|
||||
|
||||
// @@map("role_has_rules")
|
||||
// }
|
||||
|
||||
// model OfficesRolesHasRules {
|
||||
// uid String @id @unique @default(uuid())
|
||||
// office_role OfficeRoles @relation(fields: [office_role_uid], references: [uid], onDelete: Cascade)
|
||||
// rule Rules @relation(fields: [rule_uid], references: [uid], onDelete: Cascade)
|
||||
// office_role_uid String @db.VarChar(255)
|
||||
// rule_uid String @db.VarChar(255)
|
||||
// created_at DateTime? @default(now())
|
||||
// updated_at DateTime? @updatedAt
|
||||
|
||||
// @@map("office_role_has_rules")
|
||||
// }
|
||||
|
||||
enum ECivility {
|
||||
MALE
|
||||
FEMALE
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,38 +0,0 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { Addresses } from "@prisma/client";
|
||||
|
||||
@Service()
|
||||
export default class AddressesRepository extends BaseRepository {
|
||||
constructor(private database: Database) {
|
||||
super();
|
||||
}
|
||||
protected get model() {
|
||||
return this.database.getClient().addresses;
|
||||
}
|
||||
protected get instanceDb() {
|
||||
return this.database.getClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find many addresses
|
||||
*/
|
||||
public async findMany(query: any): Promise<Addresses[]> {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find one address
|
||||
*/
|
||||
public async findOneByUid(uid: string): Promise<Addresses | null> {
|
||||
const addressEntity = await this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
});
|
||||
|
||||
return addressEntity;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { Contacts } from "@prisma/client";
|
||||
|
||||
@Service()
|
||||
export default class ContactsRepository extends BaseRepository {
|
||||
constructor(private database: Database) {
|
||||
super();
|
||||
}
|
||||
protected get model() {
|
||||
return this.database.getClient().contacts;
|
||||
}
|
||||
protected get instanceDb() {
|
||||
return this.database.getClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find many contacts
|
||||
*/
|
||||
public async findMany(query: any): Promise<Contacts[]> {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find unique contact
|
||||
*/
|
||||
public async findOneByUid(uid: string): Promise<Contacts | null> {
|
||||
const contactEntity = await this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
});
|
||||
|
||||
return contactEntity;
|
||||
}
|
||||
}
|
@ -19,11 +19,7 @@ export default class CustomersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many customers
|
||||
*/
|
||||
public async findMany(query: Prisma.CustomersFindManyArgs): Promise<
|
||||
(Customers & {
|
||||
contact: Contacts;
|
||||
})[]
|
||||
> {
|
||||
public async findMany(query: Prisma.CustomersFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
if (!query.include) return this.model.findMany({ ...query, include: { contact: true } });
|
||||
return this.model.findMany({ ...query, include: { contact: { include: { address: true } } } });
|
||||
@ -32,7 +28,7 @@ export default class CustomersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create a customer
|
||||
*/
|
||||
public async create(customer: Customer): Promise<Customers> {
|
||||
public async create(customer: Customer): Promise<Customers & { contact: Contacts }> {
|
||||
const createArgs: Prisma.CustomersCreateArgs = {
|
||||
data: {
|
||||
status: ECustomerStatus.PENDING,
|
||||
@ -50,12 +46,12 @@ export default class CustomersRepository extends BaseRepository {
|
||||
},
|
||||
};
|
||||
|
||||
if (customer.contact!.address) {
|
||||
if (customer.contact?.address) {
|
||||
createArgs.data.contact!.create!.address = {
|
||||
create: {
|
||||
address: customer.contact!.address!.address,
|
||||
zip_code: customer.contact!.address!.zip_code,
|
||||
city: customer.contact!.address!.city,
|
||||
address: customer.contact?.address?.address,
|
||||
zip_code: customer.contact?.address?.zip_code,
|
||||
city: customer.contact?.address?.city,
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -65,7 +61,7 @@ export default class CustomersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Update data from a customer
|
||||
*/
|
||||
public async update(uid: string, customer: Customer): Promise<Customers> {
|
||||
public async update(uid: string, customer: Customer): Promise<Customers & { contact: Contacts }> {
|
||||
const updateArgs: Prisma.CustomersUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
@ -98,17 +94,12 @@ export default class CustomersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find unique customer
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Customers | null> {
|
||||
const findOneArgs: Prisma.CustomersFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.CustomersInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const customerEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return customerEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { DeedTypes, Prisma } from "@prisma/client";
|
||||
import { DeedTypes, DocumentTypes, Prisma } from "@prisma/client";
|
||||
import { DeedType } from "le-coffre-resources/dist/SuperAdmin";
|
||||
|
||||
@Service()
|
||||
@ -19,7 +19,7 @@ export default class DeedTypesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many deed types
|
||||
*/
|
||||
public async findMany(query: any): Promise<DeedTypes[]> {
|
||||
public async findMany(query: Prisma.DeedTypesFindManyArgs): Promise<DeedTypes[]> {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -39,23 +39,20 @@ export default class DeedTypesRepository extends BaseRepository {
|
||||
},
|
||||
},
|
||||
};
|
||||
if (deedType.deed_type_has_document_types) {
|
||||
createArgs.data.deed_type_has_document_types = {
|
||||
createMany: {
|
||||
data: deedType.deed_type_has_document_types.map((relation) => ({
|
||||
document_type_uid: relation.document_type.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
if (deedType.document_types) {
|
||||
createArgs.data.document_types = {
|
||||
connect: deedType.document_types.map((documentType) => ({
|
||||
uid: documentType.uid,
|
||||
})),
|
||||
};
|
||||
}
|
||||
return this.model.create(createArgs);
|
||||
return this.model.create({...createArgs, include: { document_types: true }});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Update data of a deed type
|
||||
*/
|
||||
public async update(uid: string, deedType: DeedType): Promise<DeedTypes> {
|
||||
public async update(uid: string, deedType: DeedType): Promise<DeedTypes & {document_types: DocumentTypes[]}> {
|
||||
const updateArgs: Prisma.DeedTypesUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
@ -69,39 +66,26 @@ export default class DeedTypesRepository extends BaseRepository {
|
||||
uid: deedType.office!.uid,
|
||||
},
|
||||
},
|
||||
},
|
||||
include: {
|
||||
deed_type_has_document_types: true,
|
||||
document_types: {
|
||||
set: deedType.document_types?.map((documentType) => ({
|
||||
uid: documentType.uid!,
|
||||
}))
|
||||
}
|
||||
},
|
||||
};
|
||||
if (deedType.deed_type_has_document_types) {
|
||||
updateArgs.data.deed_type_has_document_types = {
|
||||
deleteMany: { deed_type_uid: uid },
|
||||
createMany: {
|
||||
data: deedType.deed_type_has_document_types.map((relation) => ({
|
||||
document_type_uid: relation.document_type.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
return this.model.update(updateArgs);
|
||||
|
||||
return this.model.update({...updateArgs, include: { document_types: true }});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find unique deed type
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<DeedTypes | null> {
|
||||
const findOneArgs: Prisma.DeedTypesFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.DeedTypesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const deedTypeEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return deedTypeEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { Deeds, Prisma } from "@prisma/client";
|
||||
import { Deeds, DocumentTypes, Prisma } from "@prisma/client";
|
||||
import { Deed } from "le-coffre-resources/dist/Notary";
|
||||
|
||||
@Service()
|
||||
@ -19,7 +19,7 @@ export default class DeedsRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many users
|
||||
*/
|
||||
public async findMany(query: any): Promise<Deeds[]> {
|
||||
public async findMany(query: Prisma.DeedsFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -27,7 +27,7 @@ export default class DeedsRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create a deed based on a deed type
|
||||
*/
|
||||
public async create(deed: Deed): Promise<Deeds> {
|
||||
public async create(deed: Deed): Promise<Deeds & { document_types: DocumentTypes[] }> {
|
||||
const createArgs: Prisma.DeedsCreateArgs = {
|
||||
data: {
|
||||
deed_type: {
|
||||
@ -41,66 +41,53 @@ export default class DeedsRepository extends BaseRepository {
|
||||
where: {
|
||||
uid: deed.deed_type!.uid,
|
||||
},
|
||||
include: { deed_type_has_document_types: true },
|
||||
include: { document_types: true },
|
||||
});
|
||||
|
||||
if (deedTypeWithDocumentTypes.archived_at) throw new Error("deed type is archived");
|
||||
|
||||
if (deedTypeWithDocumentTypes.deed_type_has_document_types) {
|
||||
createArgs.data.deed_has_document_types = {
|
||||
createMany: {
|
||||
data: deedTypeWithDocumentTypes.deed_type_has_document_types.map((relation) => ({
|
||||
document_type_uid: relation.document_type_uid,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
if (deedTypeWithDocumentTypes.document_types) {
|
||||
createArgs.data.document_types = {
|
||||
connect: deedTypeWithDocumentTypes.document_types.map((documentType) => ({
|
||||
uid: documentType.uid,
|
||||
})),
|
||||
};
|
||||
}
|
||||
return this.model.create(createArgs);
|
||||
return this.model.create({ ...createArgs, include: { document_types: true } });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Update data of a deed type
|
||||
*/
|
||||
public async update(uid: string, deed: Deed): Promise<Deeds> {
|
||||
public async update(uid: string, deed: Deed): Promise<Deeds & { document_types: DocumentTypes[] }> {
|
||||
const updateArgs: Prisma.DeedsUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
data: {},
|
||||
data: {
|
||||
document_types: {
|
||||
set: deed.document_types?.map((documentType) => ({
|
||||
uid: documentType.uid!,
|
||||
})),
|
||||
},
|
||||
},
|
||||
include: {
|
||||
deed_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
};
|
||||
|
||||
if (deed.deed_has_document_types) {
|
||||
updateArgs.data.deed_has_document_types = {
|
||||
deleteMany: { deed_uid: uid },
|
||||
createMany: {
|
||||
data: deed.deed_has_document_types.map((relation) => ({
|
||||
document_type_uid: relation.document_type.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
return this.model.update(updateArgs);
|
||||
|
||||
return this.model.update({ ...updateArgs, include: { document_types: true } });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find unique deed
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Deeds | null> {
|
||||
const findOneArgs: Prisma.DeedsFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.DeedsInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const deedTypeEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return deedTypeEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export default class DocumentTypesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many document types
|
||||
*/
|
||||
public async findMany(query: any): Promise<DocumentTypes[]> {
|
||||
public async findMany(query: Prisma.DocumentTypesFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -28,7 +28,7 @@ export default class DocumentTypesRepository extends BaseRepository {
|
||||
* @description : Create a document type
|
||||
*/
|
||||
public async create(documentType: DocumentType): Promise<DocumentTypes> {
|
||||
return this.model.create({
|
||||
const createArgs: Prisma.DocumentTypesCreateArgs = {
|
||||
data: {
|
||||
name: documentType.name,
|
||||
public_description: documentType.public_description,
|
||||
@ -39,14 +39,15 @@ export default class DocumentTypesRepository extends BaseRepository {
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
return this.model.create(createArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : update given document type
|
||||
*/
|
||||
public async update(uid: string, documentType: DocumentType): Promise<DocumentTypes> {
|
||||
return this.model.update({
|
||||
const updateArgs: Prisma.DocumentTypesUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
@ -60,24 +61,21 @@ export default class DocumentTypesRepository extends BaseRepository {
|
||||
uid: documentType.office!.uid,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return this.model.update(updateArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : find unique document type
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<DocumentTypes | null> {
|
||||
const findOneArgs: Prisma.DocumentTypesFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.DocumentTypesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const documentTypeEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return documentTypeEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { Documents, EDocumentStatus, Prisma } from "@prisma/client";
|
||||
import { DocumentTypes, Documents, EDocumentStatus, Prisma } from "@prisma/client";
|
||||
import { Document } from "le-coffre-resources/dist/SuperAdmin";
|
||||
|
||||
@Service()
|
||||
@ -19,7 +19,7 @@ export default class DocumentsRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many documents
|
||||
*/
|
||||
public async findMany(query: any): Promise<Documents[]> {
|
||||
public async findMany(query: Prisma.DocumentsFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -27,8 +27,8 @@ export default class DocumentsRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create a document
|
||||
*/
|
||||
public async create(document: Document): Promise<Documents> {
|
||||
const documentCreated = await this.model.create({
|
||||
public async create(document: Document): Promise<Documents & {document_type: DocumentTypes}> {
|
||||
const createArgs: Prisma.DocumentsCreateArgs = {
|
||||
data: {
|
||||
folder: {
|
||||
connect: {
|
||||
@ -46,7 +46,9 @@ export default class DocumentsRepository extends BaseRepository {
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const documentCreated = await this.model.create({...createArgs, include: {document_type: true}});
|
||||
|
||||
await this.instanceDb.documentHistory.create({
|
||||
data: {
|
||||
@ -64,15 +66,29 @@ export default class DocumentsRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create many documents linked to an office folder
|
||||
*/
|
||||
public async createMany(documents: Document[]): Promise<Prisma.BatchPayload> {
|
||||
return this.model.createMany({
|
||||
public async createMany(documents: Document[]): Promise<Documents[]> {
|
||||
const createArgs: Prisma.DocumentsCreateManyArgs = {
|
||||
data: documents.map((document) => ({
|
||||
folder_uid: document.folder!.uid!,
|
||||
depositor_uid: document.depositor!.uid!,
|
||||
document_type_uid: document.document_type!.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
});
|
||||
};
|
||||
|
||||
const batchPayload = await this.model.createMany(createArgs);
|
||||
|
||||
const documentsCreated = await this.model.findMany({orderBy: {created_at: 'desc'}, take: batchPayload.count});
|
||||
|
||||
const createHistoryArgs: Prisma.DocumentHistoryCreateManyArgs = {
|
||||
data: documentsCreated.map((document) => ({
|
||||
document_uid: document.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
};
|
||||
await this.instanceDb.documentHistory.createMany(createHistoryArgs);
|
||||
|
||||
return documentsCreated;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,17 +125,12 @@ export default class DocumentsRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find unique document
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Documents | null> {
|
||||
const findOneArgs: Prisma.DocumentsFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.DocumentsInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const documentEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return documentEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { Files } from "@prisma/client";
|
||||
import { Documents, Files, Prisma } from "@prisma/client";
|
||||
import { File } from "le-coffre-resources/dist/SuperAdmin";
|
||||
|
||||
@Service()
|
||||
@ -19,7 +19,7 @@ export default class FilesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many files
|
||||
*/
|
||||
public async findMany(query: any): Promise<Files[]> {
|
||||
public async findMany(query: Prisma.FilesFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -27,8 +27,8 @@ export default class FilesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create a file linked to a document
|
||||
*/
|
||||
public async create(file: File, key: string): Promise<Files> {
|
||||
return this.model.create({
|
||||
public async create(file: File, key: string): Promise<Files & {document: Documents}> {
|
||||
const createArgs: Prisma.FilesCreateArgs = {
|
||||
data: {
|
||||
document: {
|
||||
connect: {
|
||||
@ -40,30 +40,35 @@ export default class FilesRepository extends BaseRepository {
|
||||
mimetype: file.mimetype,
|
||||
size: file.size,
|
||||
key: key
|
||||
},
|
||||
include: { document: true }
|
||||
});
|
||||
}
|
||||
};
|
||||
return this.model.create({...createArgs, include: { document: true }});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Update data of a file
|
||||
*/
|
||||
public async update(uid: string, file: File): Promise<Files> {
|
||||
return this.model.update({
|
||||
public async update(uid: string, file: File, key: string): Promise<Files& {document: Documents}> {
|
||||
const updateArgs: Prisma.FilesUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
data: {
|
||||
file_name: file.file_name,
|
||||
file_path: file.file_path,
|
||||
},
|
||||
});
|
||||
mimetype: file.mimetype,
|
||||
size: file.size,
|
||||
key: key
|
||||
}
|
||||
};
|
||||
return this.model.update({...updateArgs, include: { document: true }});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Delete a file key and archive
|
||||
*/
|
||||
public async deleteKeyAndArchive(uid: string): Promise<Files> {
|
||||
return this.model.update({
|
||||
public async deleteKeyAndArchive(uid: string): Promise<Files& {document: Documents}> {
|
||||
const updateArgs: Prisma.FilesUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
@ -71,19 +76,19 @@ export default class FilesRepository extends BaseRepository {
|
||||
key: null,
|
||||
archived_at: new Date(Date.now())
|
||||
}
|
||||
});
|
||||
};
|
||||
return this.model.update({...updateArgs, include: { document: true }});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find unique file
|
||||
*/
|
||||
public async findOneByUid(uid: string): Promise<Files | null> {
|
||||
const fileEntity = await this.model.findUnique({
|
||||
public async findOneByUid(uid: string, query?: Prisma.FilesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
include: query,
|
||||
});
|
||||
|
||||
return fileEntity;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { EFolderStatus, OfficeFolders, Prisma } from "@prisma/client";
|
||||
import { Customers, Documents, EFolderStatus, OfficeFolders, Prisma, Users } from "@prisma/client";
|
||||
import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin";
|
||||
|
||||
@Service()
|
||||
@ -19,7 +19,7 @@ export default class OfficeFoldersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many office folders
|
||||
*/
|
||||
public async findMany(query: any): Promise<OfficeFolders[]> {
|
||||
public async findMany(query: Prisma.OfficeFoldersFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -27,7 +27,7 @@ export default class OfficeFoldersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create new office folder with stakeholders
|
||||
*/
|
||||
public async create(officeFolder: OfficeFolder): Promise<OfficeFolders> {
|
||||
public async create(officeFolder: OfficeFolder): Promise<OfficeFolders & { stakeholders: Users[]}> {
|
||||
const createArgs: Prisma.OfficeFoldersCreateArgs = {
|
||||
data: {
|
||||
folder_number: officeFolder.folder_number,
|
||||
@ -36,7 +36,7 @@ export default class OfficeFoldersRepository extends BaseRepository {
|
||||
status: EFolderStatus.LIVE,
|
||||
deed: {
|
||||
connect: {
|
||||
uid: officeFolder.deed?.uid
|
||||
uid: officeFolder.deed?.uid,
|
||||
},
|
||||
},
|
||||
office: {
|
||||
@ -44,28 +44,24 @@ export default class OfficeFoldersRepository extends BaseRepository {
|
||||
uid: officeFolder.office!.uid,
|
||||
},
|
||||
},
|
||||
},
|
||||
include: {
|
||||
office_folder_has_stakeholder: true,
|
||||
},
|
||||
};
|
||||
if (officeFolder.office_folder_has_stakeholder) {
|
||||
createArgs.data.office_folder_has_stakeholder = {
|
||||
createMany: {
|
||||
data: officeFolder.office_folder_has_stakeholder.map((relation) => ({
|
||||
user_stakeholder_uid: relation.user_stakeholder.uid!,
|
||||
stakeholders: {
|
||||
connect: officeFolder.stakeholders?.map((stakeholder) => ({
|
||||
uid: stakeholder.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
return this.model.create(createArgs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this.model.create({...createArgs, include: {stakeholders: true}});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Update data of an office folder
|
||||
*/
|
||||
public async update(officeFolderuid: string, officeFolder: OfficeFolder): Promise<OfficeFolders> {
|
||||
public async update(
|
||||
officeFolderuid: string,
|
||||
officeFolder: OfficeFolder,
|
||||
): Promise<OfficeFolders & { stakeholders: Users[]; customers: Customers[]; documents: Documents[] }> {
|
||||
const updateArgs: Prisma.OfficeFoldersUpdateArgs = {
|
||||
where: {
|
||||
uid: officeFolderuid,
|
||||
@ -76,64 +72,44 @@ export default class OfficeFoldersRepository extends BaseRepository {
|
||||
description: officeFolder.description,
|
||||
status: EFolderStatus[officeFolder.status as keyof typeof EFolderStatus],
|
||||
archived_description: officeFolder.archived_description,
|
||||
},
|
||||
include: {
|
||||
office_folder_has_stakeholder: true,
|
||||
office_folder_has_customers: true,
|
||||
documents: true,
|
||||
stakeholders: {
|
||||
set: officeFolder.stakeholders?.map((stakeholder) => ({
|
||||
uid: stakeholder.uid!,
|
||||
})),
|
||||
},
|
||||
customers: {
|
||||
set: officeFolder.customers?.map((customer) => ({
|
||||
uid: customer.uid!,
|
||||
})),
|
||||
},
|
||||
documents: {
|
||||
set: officeFolder.documents?.map((document) => ({
|
||||
uid: document.uid!,
|
||||
})),
|
||||
},
|
||||
},
|
||||
};
|
||||
if (officeFolder.office_folder_has_stakeholder) {
|
||||
updateArgs.data.office_folder_has_stakeholder = {
|
||||
deleteMany: { office_folder_uid: officeFolderuid },
|
||||
createMany: {
|
||||
data: officeFolder.office_folder_has_stakeholder.map((relation) => ({
|
||||
user_stakeholder_uid: relation.user_stakeholder.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
if (officeFolder.office_folder_has_customers) {
|
||||
updateArgs.data.office_folder_has_customers = {
|
||||
deleteMany: { office_folder_uid: officeFolderuid },
|
||||
createMany: {
|
||||
data: officeFolder.office_folder_has_customers.map((relation) => ({
|
||||
customer_uid: relation.customer.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
if (officeFolder.documents) {
|
||||
updateArgs.data.documents = {
|
||||
createMany: {
|
||||
data: officeFolder.documents.map((relation) => ({
|
||||
document_type_uid: relation.document_type!.uid!,
|
||||
depositor_uid: relation.depositor!.uid!,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
return this.model.update(updateArgs);
|
||||
|
||||
return this.model.update({
|
||||
...updateArgs,
|
||||
include: {
|
||||
stakeholders: true,
|
||||
customers: true,
|
||||
documents: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find one office folder
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<OfficeFolders | null> {
|
||||
const findOneArgs: Prisma.OfficeFoldersFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.OfficeFoldersInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const officeFolderEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return officeFolderEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Database from "@Common/databases/database";
|
||||
import BaseRepository from "@Repositories/BaseRepository";
|
||||
import { Service } from "typedi";
|
||||
import { OfficeRoles, Prisma } from "@prisma/client";
|
||||
import { OfficeRoles, Prisma, Rules } from "@prisma/client";
|
||||
import { OfficeRole } from "le-coffre-resources/dist/SuperAdmin";
|
||||
|
||||
@Service()
|
||||
@ -19,7 +19,7 @@ export default class OfficeRolesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many officeRoles
|
||||
*/
|
||||
public async findMany(query: any): Promise<OfficeRoles[]> {
|
||||
public async findMany(query: Prisma.OfficeRolesFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -27,7 +27,7 @@ export default class OfficeRolesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Create new officeRole with rules
|
||||
*/
|
||||
public async create(officeRole: OfficeRole): Promise<OfficeRoles> {
|
||||
public async create(officeRole: OfficeRole): Promise<OfficeRoles & {rules: Rules[]}> {
|
||||
const createArgs: Prisma.OfficeRolesCreateArgs = {
|
||||
data: {
|
||||
name: officeRole.name,
|
||||
@ -44,13 +44,13 @@ export default class OfficeRolesRepository extends BaseRepository {
|
||||
},
|
||||
};
|
||||
|
||||
return this.model.create(createArgs);
|
||||
return this.model.create({...createArgs, include: {rules: true}});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Update data of a officeRole with rules
|
||||
*/
|
||||
public async update(officeRole: OfficeRole): Promise<OfficeRoles> {
|
||||
public async update(officeRole: OfficeRole): Promise<OfficeRoles & {rules: Rules[]}> {
|
||||
const updateArgs: Prisma.OfficeRolesUpdateArgs = {
|
||||
where: {
|
||||
uid: officeRole.uid,
|
||||
@ -65,24 +65,19 @@ export default class OfficeRolesRepository extends BaseRepository {
|
||||
},
|
||||
};
|
||||
|
||||
return this.model.update(updateArgs);
|
||||
return this.model.update({...updateArgs, include: {rules: true}});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find one officeRole
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<OfficeRoles | null> {
|
||||
const findOneArgs: Prisma.OfficeRolesFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.OfficeRolesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const officeRoleEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return officeRoleEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ export default class OfficesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many users
|
||||
*/
|
||||
public async findMany(query: any): Promise<Offices[]> {
|
||||
public async findMany(query: Prisma.OfficesFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
|
||||
return this.model.findMany(query);
|
||||
@ -29,7 +29,7 @@ export default class OfficesRepository extends BaseRepository {
|
||||
* @description : Create an office
|
||||
*/
|
||||
public async create(office: OfficeRessource): Promise<Offices> {
|
||||
return this.model.create({
|
||||
const createArgs: Prisma.OfficesCreateArgs = {
|
||||
data: {
|
||||
idNot: office.idNot,
|
||||
name: office.name,
|
||||
@ -43,14 +43,15 @@ export default class OfficesRepository extends BaseRepository {
|
||||
},
|
||||
office_status: EOfficeStatus.DESACTIVATED,
|
||||
},
|
||||
});
|
||||
};
|
||||
return this.model.create(createArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Update data from an office
|
||||
*/
|
||||
public async update(uid: string, office: OfficeRessource): Promise<Offices> {
|
||||
return this.model.update({
|
||||
const updateArgs: Prisma.OfficesUpdateArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
@ -65,23 +66,29 @@ export default class OfficesRepository extends BaseRepository {
|
||||
},
|
||||
office_status: EOfficeStatus[office.office_status as keyof typeof EOfficeStatus],
|
||||
},
|
||||
};
|
||||
return this.model.update(updateArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find one office
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: Prisma.OfficesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Find one office
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Offices | null> {
|
||||
const findOneArgs: Prisma.OfficesFindUniqueArgs = {
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const officeEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return officeEntity;
|
||||
public async findOneByProvider(providerName: string, id: string, query?: Prisma.OfficesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: { [providerName]: id },
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export default class RolesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many roles
|
||||
*/
|
||||
public async findMany(query: any): Promise<Roles[]> {
|
||||
public async findMany(query: Prisma.RolesFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -66,18 +66,13 @@ export default class RolesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find one role
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Roles | null> {
|
||||
const findOneArgs: Prisma.RolesFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.RolesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const roleEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return roleEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ export default class RulesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find many rules
|
||||
*/
|
||||
public async findMany(query: any): Promise<Rules[]> {
|
||||
public async findMany(query: Prisma.RulesFindManyArgs) {
|
||||
query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows);
|
||||
return this.model.findMany(query);
|
||||
}
|
||||
@ -56,18 +56,13 @@ export default class RulesRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find one rule
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Rules | null> {
|
||||
const findOneArgs: Prisma.RulesFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.RulesInclude) {
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const ruleEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return ruleEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,18 +157,13 @@ export default class UsersRepository extends BaseRepository {
|
||||
/**
|
||||
* @description : Find one user
|
||||
*/
|
||||
public async findOneByUid(uid: string, query?: any): Promise<Users | null> {
|
||||
const findOneArgs: Prisma.UsersFindUniqueArgs = {
|
||||
public async findOneByUid(uid: string, query?: Prisma.UsersInclude){
|
||||
return this.model.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
},
|
||||
};
|
||||
if (query) {
|
||||
findOneArgs.include = query;
|
||||
}
|
||||
const userEntity = await this.model.findUnique(findOneArgs);
|
||||
|
||||
return userEntity;
|
||||
include: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,27 +0,0 @@
|
||||
import AddressesRepository from "@Repositories/AddressesRepository";
|
||||
import BaseService from "@Services/BaseService";
|
||||
import { Addresses } from "@prisma/client";
|
||||
import { Service } from "typedi";
|
||||
|
||||
@Service()
|
||||
export default class AddressesService extends BaseService {
|
||||
constructor(private addressRepository: AddressesRepository) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Get all addresses
|
||||
* @throws {Error} If addresses cannot be get
|
||||
*/
|
||||
public async get(query: any): Promise<Addresses[]> {
|
||||
return this.addressRepository.findMany(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Get a address by uid
|
||||
* @throws {Error} If address cannot be get
|
||||
*/
|
||||
public async getByUid(uid: string): Promise<Addresses | null> {
|
||||
return this.addressRepository.findOneByUid(uid);
|
||||
}
|
||||
}
|
@ -32,19 +32,29 @@ export default class AuthService extends BaseService {
|
||||
if (!user) return null;
|
||||
|
||||
const rules: string[] = [];
|
||||
if (user.office_role?.rules.length) {
|
||||
user.office_role.rules.forEach((relation: any) => {
|
||||
rules.push(relation.rule.name);
|
||||
if (user.office_role) {
|
||||
user.office_role.rules.forEach((rule) => {
|
||||
rules.push(rule.name);
|
||||
});
|
||||
return { userId: user.uid, openId: {providerName: providerName, userId: user.idNot}, office_IdNot_Id: user.office_membership.idNot, role: user.role.name, rules: rules };
|
||||
return {
|
||||
userId: user.uid,
|
||||
openId: { providerName: providerName, userId: user.idNot },
|
||||
office_IdNot_Id: user.office_membership.idNot,
|
||||
role: user.role.name,
|
||||
rules: rules,
|
||||
};
|
||||
}
|
||||
|
||||
if (!rules.length) {
|
||||
user.role.rules.forEach((relation: any) => {
|
||||
rules.push(relation.rule.name);
|
||||
});
|
||||
}
|
||||
return { userId: user.uid, openId: {providerName: providerName, userId: user.idNot}, office_IdNot_Id: user.office_membership.idNot, role: user.role.name, rules: rules };
|
||||
user.role.rules.forEach((rule) => {
|
||||
rules.push(rule.name);
|
||||
});
|
||||
return {
|
||||
userId: user.uid,
|
||||
openId: { providerName: providerName, userId: user.idNot },
|
||||
office_IdNot_Id: user.office_membership.idNot,
|
||||
role: user.role.name,
|
||||
rules: rules,
|
||||
};
|
||||
}
|
||||
|
||||
public generateAccessToken(user: any): string {
|
||||
|
@ -1,27 +0,0 @@
|
||||
import ContactsRepository from "@Repositories/ContactsRepository";
|
||||
import BaseService from "@Services/BaseService";
|
||||
import { Contacts } from "@prisma/client";
|
||||
import { Service } from "typedi";
|
||||
|
||||
@Service()
|
||||
export default class ContactsService extends BaseService {
|
||||
constructor(private contactRepository: ContactsRepository) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Get all contacts
|
||||
* @throws {Error} If contacts cannot be get
|
||||
*/
|
||||
public async get(query: any): Promise<Contacts[]> {
|
||||
return this.contactRepository.findMany(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : Get a contact by uid
|
||||
* @throws {Error} If contact cannot be get
|
||||
*/
|
||||
public async getByUid(uid: string): Promise<Contacts | null> {
|
||||
return this.contactRepository.findOneByUid(uid);
|
||||
}
|
||||
}
|
@ -72,7 +72,8 @@ export default class FilesService extends BaseService {
|
||||
* @throws {Error} If file cannot be modified
|
||||
*/
|
||||
public async update(uid: string, file: File): Promise<Files> {
|
||||
return this.filesRepository.update(uid, file);
|
||||
const key = v4();
|
||||
return this.filesRepository.update(uid, file, key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Documents, Prisma } from "@prisma/client";
|
||||
import { Documents } from "@prisma/client";
|
||||
import { Document } from "le-coffre-resources/dist/Customer";
|
||||
import DocumentsRepository from "@Repositories/DocumentsRepository";
|
||||
import BaseService from "@Services/BaseService";
|
||||
@ -30,7 +30,7 @@ export default class DocumentsService extends BaseService {
|
||||
* @description : Create new documents
|
||||
* @throws {Error} If documents or one of them cannot be created
|
||||
*/
|
||||
public async createMany(documents: Document[]): Promise<Prisma.BatchPayload> {
|
||||
public async createMany(documents: Document[]): Promise<Documents[]> {
|
||||
return this.documentsRepository.createMany(documents);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Documents, Prisma } from "@prisma/client";
|
||||
import { Documents } from "@prisma/client";
|
||||
import { Document } from "le-coffre-resources/dist/SuperAdmin";
|
||||
import DocumentsRepository from "@Repositories/DocumentsRepository";
|
||||
import BaseService from "@Services/BaseService";
|
||||
@ -30,7 +30,7 @@ export default class DocumentsService extends BaseService {
|
||||
* @description : Create new documents
|
||||
* @throws {Error} If documents or one of them cannot be created
|
||||
*/
|
||||
public async createMany(documents: Document[]): Promise<Prisma.BatchPayload> {
|
||||
public async createMany(documents: Document[]): Promise<Documents[]> {
|
||||
return this.documentsRepository.createMany(documents);
|
||||
}
|
||||
|
||||
|
@ -59,11 +59,11 @@ export default class OfficeFoldersService extends BaseService {
|
||||
* @throws {Error} If document cannot be deleted
|
||||
*/
|
||||
public async delete(uid: string): Promise<OfficeFolders> {
|
||||
const officeFolderEntity = await this.officeFoldersRepository.findOneByUid(uid, { office_folder_has_customers: true });
|
||||
const officeFolderEntity = await this.officeFoldersRepository.findOneByUid(uid, { customers: true });
|
||||
if(!officeFolderEntity) throw new Error('office folder not found');
|
||||
const officeFolder = OfficeFolder.hydrate<OfficeFolder>(officeFolderEntity, { strategy: "excludeAll" });
|
||||
|
||||
if (officeFolder.office_folder_has_customers && officeFolder.office_folder_has_customers.length !== 0) {
|
||||
if (officeFolder.customers?.length) {
|
||||
throw new Error("This folder is used by customers");
|
||||
}
|
||||
return this.officeFoldersRepository.delete(uid);
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
ECivility,
|
||||
ECustomerStatus,
|
||||
Offices,
|
||||
Prisma,
|
||||
PrismaClient,
|
||||
Roles,
|
||||
Rules,
|
||||
@ -43,23 +44,26 @@ export const initDocumentType = (documentType: DocumentType, office: Office): Pr
|
||||
});
|
||||
};
|
||||
|
||||
export const initDeedType = (deedType: DeedType, office: Office, documentTypes?: string[]): Promise<DeedTypes> => {
|
||||
return prisma.deedTypes.create({
|
||||
export const initDeedType = (deedType: DeedType): Promise<DeedTypes> => {
|
||||
const createArgs: Prisma.DeedTypesCreateArgs = {
|
||||
data: {
|
||||
name: deedType.name,
|
||||
description: deedType.description,
|
||||
archived_at: null,
|
||||
office_uid: office.uid!,
|
||||
deed_type_has_document_types: {
|
||||
createMany: {
|
||||
data: documentTypes!.map((documentType) => ({
|
||||
document_type_uid: documentType,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
office: {
|
||||
connect: {
|
||||
uid: deedType.office!.uid,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
if (deedType.document_types) {
|
||||
createArgs.data.document_types = {
|
||||
connect: deedType.document_types.map((documentType) => ({
|
||||
uid: documentType.uid,
|
||||
})),
|
||||
};
|
||||
}
|
||||
return prisma.deedTypes.create(createArgs);
|
||||
};
|
||||
|
||||
export const initCustomers = (customer: Customer): Promise<Customers> => {
|
||||
|
@ -144,14 +144,7 @@ export const deedType: DeedType = {
|
||||
office: office,
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
deed_type_has_document_types: [
|
||||
{
|
||||
document_type: documentType,
|
||||
deed_type: new DeedType(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
],
|
||||
document_types: [documentType],
|
||||
};
|
||||
|
||||
export const deedType_: DeedType = {
|
||||
@ -197,34 +190,8 @@ export const officeFolder: OfficeFolder = {
|
||||
status: "ARCHIVED",
|
||||
deed: deed,
|
||||
office: office,
|
||||
office_folder_has_customers: [
|
||||
{
|
||||
customer: customer,
|
||||
office_folder: new OfficeFolder(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
customer: customer_,
|
||||
office_folder: new OfficeFolder(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
],
|
||||
office_folder_has_stakeholder: [
|
||||
{
|
||||
user_stakeholder: user,
|
||||
office_folder: new OfficeFolder(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
user_stakeholder: user_,
|
||||
office_folder: new OfficeFolder(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
],
|
||||
customers: [customer, customer_],
|
||||
stakeholders: [user, user_],
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ beforeAll(async () => {
|
||||
office.uid = (await initOffice(office)).uid;
|
||||
documentType.uid = (await initDocumentType(documentType, office)).uid;
|
||||
documentType_.uid = (await initDocumentType(documentType_, office)).uid;
|
||||
deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uid;
|
||||
deedType.uid = (await initDeedType(deedType)).uid;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
@ -46,9 +46,9 @@ describe("test create function", () => {
|
||||
});
|
||||
|
||||
it("should have by default the same document types as its deed type ", async () => {
|
||||
const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { deed_has_document_types: true } });
|
||||
expect(deedWithDocumentTypes.deed_has_document_types.length).toEqual(1);
|
||||
expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uid).toEqual(documentType.uid);
|
||||
const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { document_types: true } });
|
||||
expect(deedWithDocumentTypes.document_types.length).toEqual(1);
|
||||
expect(deedWithDocumentTypes.document_types[0]?.uid).toEqual(documentType.uid);
|
||||
});
|
||||
|
||||
it("should create a the same deed based on existing deed type", async () => {
|
||||
@ -83,20 +83,7 @@ describe("test update function", () => {
|
||||
const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uid: deedType.uid } })).uid;
|
||||
let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed));
|
||||
|
||||
deedToUpdate.deed_has_document_types = [
|
||||
{
|
||||
document_type: documentType,
|
||||
deed: new Deed(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
document_type: documentType_,
|
||||
deed: new Deed(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
];
|
||||
deedToUpdate.document_types = [documentType, documentType_];
|
||||
|
||||
await DeedServiceTest.update(deedUid, deedToUpdate);
|
||||
|
||||
@ -105,30 +92,17 @@ describe("test update function", () => {
|
||||
uid: deedUid,
|
||||
},
|
||||
include: {
|
||||
deed_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
});
|
||||
expect(deedUpdated.deed_has_document_types.length).toEqual(2);
|
||||
expect(deedUpdated.document_types.length).toEqual(2);
|
||||
});
|
||||
|
||||
it("should not add document types to a deed type that already has those document types ", async () => {
|
||||
const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uid: deedType.uid } })).uid;
|
||||
let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed));
|
||||
|
||||
deedToUpdate.deed_has_document_types = [
|
||||
{
|
||||
document_type: documentType,
|
||||
deed: new Deed(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
document_type: documentType_,
|
||||
deed: new Deed(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
];
|
||||
deedToUpdate.document_types = [documentType, documentType_];
|
||||
|
||||
await DeedServiceTest.update(deedUid, deedToUpdate);
|
||||
|
||||
@ -137,10 +111,10 @@ describe("test update function", () => {
|
||||
uid: deedUid,
|
||||
},
|
||||
include: {
|
||||
deed_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
});
|
||||
expect(deedUpdated.deed_has_document_types.length).toEqual(2);
|
||||
expect(deedUpdated.document_types.length).toEqual(2);
|
||||
});
|
||||
|
||||
it("should delete document types from a deed", async () => {
|
||||
@ -148,7 +122,7 @@ describe("test update function", () => {
|
||||
let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed));
|
||||
|
||||
// set relation between deed and document types empty
|
||||
deedToUpdate.deed_has_document_types = [];
|
||||
deedToUpdate.document_types = [];
|
||||
|
||||
await DeedServiceTest.update(deedUid, deedToUpdate);
|
||||
|
||||
@ -157,10 +131,10 @@ describe("test update function", () => {
|
||||
uid: deedUid,
|
||||
},
|
||||
include: {
|
||||
deed_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
});
|
||||
expect(deedUpdated.deed_has_document_types.length).toEqual(0);
|
||||
expect(deedUpdated.document_types.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -188,20 +188,7 @@ describe("test update function", () => {
|
||||
const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uid: office.uid } })).uid;
|
||||
let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType));
|
||||
|
||||
deedTypeToUpdate.deed_type_has_document_types = [
|
||||
{
|
||||
document_type: documentType,
|
||||
deed_type: new DeedType(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
document_type: documentType_,
|
||||
deed_type: new DeedType(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
];
|
||||
deedTypeToUpdate.document_types = [documentType, documentType_];
|
||||
|
||||
await DeedTypeServiceTest.update(deedTypeUid, deedTypeToUpdate);
|
||||
|
||||
@ -210,30 +197,17 @@ describe("test update function", () => {
|
||||
uid: deedTypeUid,
|
||||
},
|
||||
include: {
|
||||
deed_type_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
});
|
||||
expect(deedTypeUpdated.deed_type_has_document_types.length).toEqual(2);
|
||||
expect(deedTypeUpdated.document_types.length).toEqual(2);
|
||||
});
|
||||
|
||||
it("should not add document types to a deed type that already has those document types ", async () => {
|
||||
const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uid: office.uid } })).uid;
|
||||
let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType));
|
||||
|
||||
deedTypeToUpdate.deed_type_has_document_types = [
|
||||
{
|
||||
document_type: documentType,
|
||||
deed_type: new DeedType(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
document_type: documentType_,
|
||||
deed_type: new DeedType(),
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
},
|
||||
];
|
||||
deedTypeToUpdate.document_types = [documentType, documentType_];
|
||||
|
||||
await DeedTypeServiceTest.update(deedTypeUid, deedTypeToUpdate);
|
||||
|
||||
@ -242,10 +216,10 @@ describe("test update function", () => {
|
||||
uid: deedTypeUid,
|
||||
},
|
||||
include: {
|
||||
deed_type_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
});
|
||||
expect(deedTypeUpdated.deed_type_has_document_types.length).toEqual(2);
|
||||
expect(deedTypeUpdated.document_types.length).toEqual(2);
|
||||
});
|
||||
|
||||
it("should delete document types from a deed", async () => {
|
||||
@ -253,7 +227,7 @@ describe("test update function", () => {
|
||||
let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType));
|
||||
|
||||
// set relation between deed and document types empty
|
||||
deedTypeToUpdate.deed_type_has_document_types = [];
|
||||
deedTypeToUpdate.document_types = [];
|
||||
|
||||
await DeedTypeServiceTest.update(deedTypeUid, deedTypeToUpdate);
|
||||
|
||||
@ -262,10 +236,10 @@ describe("test update function", () => {
|
||||
uid: deedTypeUid,
|
||||
},
|
||||
include: {
|
||||
deed_type_has_document_types: true,
|
||||
document_types: true,
|
||||
},
|
||||
});
|
||||
expect(deedTypeUpdated.deed_type_has_document_types.length).toEqual(0);
|
||||
expect(deedTypeUpdated.document_types.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import "module-alias/register";
|
||||
import "reflect-metadata";
|
||||
import { OfficeFolderHasCustomers, OfficeFolderHasStakeholders, PrismaClient } from "prisma/prisma-client";
|
||||
import { PrismaClient } from "prisma/prisma-client";
|
||||
import { customer, customer_, deedType, documentType, documentType_, office, officeFolder, officeFolder_, user, user_ } from "@Test/config/MockedData";
|
||||
import Container from "typedi";
|
||||
import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository";
|
||||
@ -18,7 +18,7 @@ beforeAll(async () => {
|
||||
office.uid = (await initOffice(office)).uid;
|
||||
documentType.uid = (await initDocumentType(documentType, office)).uid;
|
||||
documentType_.uid = (await initDocumentType(documentType_, office)).uid;
|
||||
deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uid;
|
||||
deedType.uid = (await initDeedType(deedType)).uid;
|
||||
user.uid = (await initUsers(user)).uid;
|
||||
user_.uid = (await initUsers(user_)).uid;
|
||||
customer.uid = (await initCustomers(customer)).uid;
|
||||
@ -72,40 +72,9 @@ describe("test create function", () => {
|
||||
|
||||
it("should contains stakeholders", async () => {
|
||||
const officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_stakeholder: true },
|
||||
include: { stakeholders: true },
|
||||
});
|
||||
const stakeholderRelation = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({
|
||||
where: {
|
||||
office_folder_uid_user_stakeholder_uid: {
|
||||
user_stakeholder_uid: user.uid!,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
},
|
||||
},
|
||||
});
|
||||
const stakeholderRelation_ = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({
|
||||
where: {
|
||||
office_folder_uid_user_stakeholder_uid: {
|
||||
user_stakeholder_uid: user_.uid!,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(2);
|
||||
const stakeholder: OfficeFolderHasStakeholders = {
|
||||
uid: stakeholderRelation.uid,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
user_stakeholder_uid: user.uid!,
|
||||
created_at: officeFolderCreated.created_at,
|
||||
updated_at: officeFolderCreated.updated_at,
|
||||
};
|
||||
const stakeholder_: OfficeFolderHasStakeholders = {
|
||||
uid: stakeholderRelation_.uid,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
user_stakeholder_uid: user_.uid!,
|
||||
created_at: officeFolderCreated.created_at,
|
||||
updated_at: officeFolderCreated.updated_at,
|
||||
};
|
||||
expect(officeFolderCreated.office_folder_has_stakeholder).toEqual(expect.arrayContaining([stakeholder, stakeholder_]));
|
||||
expect(officeFolderCreated.stakeholders).toEqual([user, user_]);
|
||||
});
|
||||
|
||||
it("should not create a new office folder with folder number already created", async () => {
|
||||
@ -131,123 +100,51 @@ describe("test create function", () => {
|
||||
describe("test update function", () => {
|
||||
it("should add customers", async () => {
|
||||
let officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_customers: true },
|
||||
include: { customers: true },
|
||||
});
|
||||
|
||||
expect(officeFolderCreated.office_folder_has_customers).toEqual([]);
|
||||
expect(officeFolderCreated.customers).toEqual([]);
|
||||
// mocked data contains the customers
|
||||
await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolder);
|
||||
|
||||
const customerRelation = await prisma.officeFolderHasCustomers.findUniqueOrThrow({
|
||||
where: {
|
||||
office_folder_uid_customer_uid: {
|
||||
customer_uid: customer.uid!,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
},
|
||||
},
|
||||
});
|
||||
const customerRelation_ = await prisma.officeFolderHasCustomers.findUniqueOrThrow({
|
||||
where: {
|
||||
office_folder_uid_customer_uid: {
|
||||
customer_uid: customer_.uid!,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_customers: true },
|
||||
include: { customers: true },
|
||||
});
|
||||
|
||||
expect(officeFolderCreated.office_folder_has_customers.length).toEqual(2);
|
||||
const officeFolderHasCustomer: OfficeFolderHasCustomers = {
|
||||
uid: customerRelation.uid,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
customer_uid: customer.uid!,
|
||||
created_at: customerRelation.created_at,
|
||||
updated_at: customerRelation.updated_at,
|
||||
};
|
||||
const officeFolderHasCustomer_: OfficeFolderHasCustomers = {
|
||||
uid: customerRelation_.uid,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
customer_uid: customer_.uid!,
|
||||
created_at: customerRelation_.created_at,
|
||||
updated_at: customerRelation_.updated_at,
|
||||
};
|
||||
expect(officeFolderCreated.office_folder_has_customers).toEqual(
|
||||
expect.arrayContaining([officeFolderHasCustomer, officeFolderHasCustomer_]),
|
||||
);
|
||||
expect(officeFolderCreated.customers.length).toEqual([customer, customer_].length);
|
||||
});
|
||||
|
||||
it("should remove customers", async () => {
|
||||
let officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_customers: true },
|
||||
include: { customers: true },
|
||||
});
|
||||
|
||||
expect(officeFolderCreated.office_folder_has_customers.length).toEqual(2);
|
||||
expect(officeFolderCreated.customers.length).toEqual(2);
|
||||
|
||||
let officeFolderWithLessCustomers: OfficeFolder = JSON.parse(JSON.stringify(officeFolder));
|
||||
officeFolderWithLessCustomers.office_folder_has_customers!.pop();
|
||||
officeFolderWithLessCustomers.customers!.pop();
|
||||
// mocked data contains the customers
|
||||
await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolderWithLessCustomers);
|
||||
|
||||
const customerRelation = await prisma.officeFolderHasCustomers.findUniqueOrThrow({
|
||||
where: {
|
||||
office_folder_uid_customer_uid: {
|
||||
customer_uid: customer.uid!,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_customers: true },
|
||||
});
|
||||
|
||||
expect(officeFolderCreated.office_folder_has_customers.length).toEqual(1);
|
||||
const officeFolderHasCustomer: OfficeFolderHasCustomers = {
|
||||
uid: customerRelation.uid,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
customer_uid: customer.uid!,
|
||||
created_at: customerRelation.created_at,
|
||||
updated_at: customerRelation.updated_at,
|
||||
};
|
||||
expect(officeFolderCreated.office_folder_has_customers).toEqual([officeFolderHasCustomer]);
|
||||
expect(officeFolderCreated.customers.length).toEqual([customer]);
|
||||
});
|
||||
it("should remove stakeholders", async () => {
|
||||
let officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_stakeholder: true },
|
||||
include: { stakeholders: true },
|
||||
});
|
||||
|
||||
expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(2);
|
||||
expect(officeFolderCreated.stakeholders.length).toEqual(2);
|
||||
|
||||
let officeFolderWithLessStakeholders: OfficeFolder = JSON.parse(JSON.stringify(officeFolder));
|
||||
officeFolderWithLessStakeholders.office_folder_has_stakeholder!.pop();
|
||||
officeFolderWithLessStakeholders.stakeholders!.pop();
|
||||
// mocked data contains the customers
|
||||
await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolderWithLessStakeholders);
|
||||
|
||||
const stakeholderRelation = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({
|
||||
where: {
|
||||
office_folder_uid_user_stakeholder_uid: {
|
||||
user_stakeholder_uid: user.uid!,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({
|
||||
include: { office_folder_has_stakeholder: true },
|
||||
include: { stakeholders: true },
|
||||
});
|
||||
|
||||
expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(1);
|
||||
const officeFolderHasStakeholder: OfficeFolderHasStakeholders = {
|
||||
uid: stakeholderRelation.uid,
|
||||
office_folder_uid: officeFolderCreated.uid,
|
||||
user_stakeholder_uid: user.uid!,
|
||||
created_at: stakeholderRelation.created_at,
|
||||
updated_at: stakeholderRelation.updated_at,
|
||||
};
|
||||
expect(officeFolderCreated.office_folder_has_stakeholder).toEqual([officeFolderHasStakeholder]);
|
||||
expect(officeFolderCreated.stakeholders).toEqual([user]);
|
||||
});
|
||||
it("should archivate an office folder", async () => {
|
||||
const officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({});
|
||||
|
@ -69,7 +69,7 @@
|
||||
"@ControllerPattern/*": [
|
||||
"src/common/system/controller-pattern/*"
|
||||
],
|
||||
"@Test/*":[
|
||||
"@Test/*": [
|
||||
"src/test/*"
|
||||
],
|
||||
},
|
||||
@ -95,8 +95,7 @@
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"src/app/api/admin/UsersController.ts"
|
||||
, "src/common/databases/seeders/seeder.ts" ],
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user