Merge branch 'dev' into staging
This commit is contained in:
commit
915e904640
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "files_notary" ADD COLUMN "key" VARCHAR(255);
|
@ -80,6 +80,7 @@ model Whitelist {
|
||||
active Boolean @default(true)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@map("whitelist")
|
||||
}
|
||||
|
||||
@ -89,6 +90,7 @@ model UserWhitelist {
|
||||
active Boolean @default(true)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@map("user_whitelist")
|
||||
}
|
||||
|
||||
@ -131,6 +133,7 @@ model Customers {
|
||||
office_uid String @db.VarChar(255)
|
||||
notes Notes[]
|
||||
documents_notary DocumentsNotary[]
|
||||
|
||||
@@map("customers")
|
||||
}
|
||||
|
||||
@ -234,7 +237,7 @@ model DocumentsNotary {
|
||||
files FilesNotary[]
|
||||
customer Customers @relation(fields: [customer_uid], references: [uid], onDelete: Cascade)
|
||||
customer_uid String @db.VarChar(255)
|
||||
document String @db.VarChar(255) @default("")
|
||||
document String @default("") @db.VarChar(255)
|
||||
|
||||
@@map("documents_notary")
|
||||
}
|
||||
@ -288,6 +291,7 @@ model FilesNotary {
|
||||
mimetype String @db.VarChar(255)
|
||||
hash String @db.VarChar(255)
|
||||
size Int
|
||||
key String? @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@ -373,8 +377,9 @@ model Rules {
|
||||
updated_at DateTime? @updatedAt
|
||||
role Roles[] @relation("RolesHasRules")
|
||||
office_roles OfficeRoles[] @relation("OfficeRolesHasRules")
|
||||
namespace String @db.VarChar(255) @default("notary")
|
||||
namespace String @default("notary") @db.VarChar(255)
|
||||
groups RulesGroups[] @relation("RulesGroupsHasRules")
|
||||
|
||||
@@map("rules")
|
||||
}
|
||||
|
||||
@ -384,6 +389,7 @@ model RulesGroups {
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
rules Rules[] @relation("RulesGroupsHasRules")
|
||||
|
||||
@@map("rules_groups")
|
||||
}
|
||||
|
||||
@ -435,6 +441,7 @@ model TotpCodes {
|
||||
expire_at DateTime? @default(now())
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@map("totp_codes")
|
||||
}
|
||||
|
||||
@ -451,6 +458,7 @@ model Subscriptions {
|
||||
seats Seats[]
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@map("subscriptions")
|
||||
}
|
||||
|
||||
@ -462,6 +470,7 @@ model Seats {
|
||||
user_uid String @db.VarChar(255)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @updatedAt
|
||||
|
||||
@@map("seats")
|
||||
}
|
||||
|
||||
@ -474,6 +483,7 @@ model Notes {
|
||||
customer_uid String @db.VarChar(255)
|
||||
folder OfficeFolders @relation(fields: [folder_uid], references: [uid], onDelete: Cascade)
|
||||
folder_uid String @db.VarChar(255)
|
||||
|
||||
@@map("notes")
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ export default class FilesNotaryRepository extends BaseRepository {
|
||||
mimetype: file.mimetype,
|
||||
hash: file.hash,
|
||||
size: file.size,
|
||||
key: key,
|
||||
},
|
||||
};
|
||||
return this.model.create({ ...createArgs, include: { document_notary: true } });
|
||||
|
@ -61,10 +61,10 @@ export default class FilesNotaryService extends BaseService {
|
||||
*/
|
||||
public async download(uid: string) {
|
||||
const file = await this.filesNotaryRepository.findOneByUid(uid);
|
||||
if (!file?.uid) return null;
|
||||
if (!file?.key) return null;
|
||||
const fileResult = await fetch(file.file_path.concat("?pinataGatewayToken=").concat(this.variables.PINATA_GATEWAY_TOKEN));
|
||||
const fileArrayBuffer = await fileResult.arrayBuffer();
|
||||
return { file: file, buffer: await this.cryptoService.decrypt(Buffer.from(fileArrayBuffer), file.uid) };
|
||||
return { file: file, buffer: await this.cryptoService.decrypt(Buffer.from(fileArrayBuffer), file.key) };
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user