Skip to content

Commit

Permalink
delete vault
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Jul 15, 2024
1 parent c4360f6 commit e515295
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/user-vault/services/user-vault.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,18 @@ export class UserVaultService {
page,
limit,
): Promise<Array<DocumentResponseDTO>> {
// const vault = await this.vaultRepository.getVault({
// id,
// });
const vault = await this.vaultRepository.getVault({
id,
});

// if (vault == undefined || vault == null) {
// throw new HttpException({
// message: "Vault with given id does not exists",
// }, HttpStatus.NOT_FOUND)
// }
if (vault == undefined || vault == null) {
throw new HttpException(
{
message: 'Vault with given id does not exists',
},
HttpStatus.NOT_FOUND,
);
}

// const documentVaultId = getHash(id + vault.invoker);
// await this.documentRepository.connectDB(documentVaultId);
Expand Down Expand Up @@ -278,6 +281,14 @@ export class UserVaultService {
HttpStatus.NOT_FOUND,
);
}

if (invoker !== vault.invoker) {
Logger.debug(
`Invoker : ${invoker} is not authorized to access document : ${documentId} `,
'VaultService - Delete',
);
throw Error( `Invoker : ${invoker} is not authorized to access document : ${documentId} `)
}
// const docVaultId = getHash(id + vault.invoker);
// await this.documentRepository.connectDB(docVaultId);
if (invoker !== vault.invoker) {
Expand Down

0 comments on commit e515295

Please sign in to comment.