From e9a12eec00669276f4eaeca0326cec50bce5f9e6 Mon Sep 17 00:00:00 2001 From: bhavanakarwade <137506897+bhavanakarwade@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:17:58 +0530 Subject: [PATCH] refactor: enum type for delete connection (#783) * feat: delete connection records Signed-off-by: bhavanakarwade * refactor: enum changes Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade --- apps/connection/src/connection.repository.ts | 4 ++-- libs/enum/src/enum.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/connection/src/connection.repository.ts b/apps/connection/src/connection.repository.ts index 834064b0d..946016652 100644 --- a/apps/connection/src/connection.repository.ts +++ b/apps/connection/src/connection.repository.ts @@ -5,7 +5,7 @@ import { agent_invitations, org_agents, platform_config, shortening_url } from ' import { IConnectionSearchCriteria, ICreateConnection, OrgAgent } from './interfaces/connection.interfaces'; import { IUserRequest } from '@credebl/user-request/user-request.interface'; import { IConnectionsListCount, IDeletedConnectionsRecord } from '@credebl/common/interfaces/connection.interface'; -import { SortValue } from '@credebl/enum/enum'; +import { PrismaTables, SortValue } from '@credebl/enum/enum'; // import { OrgAgent } from './interfaces/connection.interfaces'; @Injectable() export class ConnectionRepository { @@ -318,7 +318,7 @@ export class ConnectionRepository { } async deleteConnectionRecordsByOrgId(orgId: string): Promise { - const tablesToCheck = ['credentials', 'presentations']; + const tablesToCheck = [`${PrismaTables.CREDENTIALS}`, `${PrismaTables.PRESENTATIONS}`]; try { return await this.prisma.$transaction(async (prisma) => { diff --git a/libs/enum/src/enum.ts b/libs/enum/src/enum.ts index 7148a0734..570b44ec5 100644 --- a/libs/enum/src/enum.ts +++ b/libs/enum/src/enum.ts @@ -146,6 +146,11 @@ export enum PromiseResult { FULFILLED = 'fulfilled' } +export enum PrismaTables { + PRESENTATIONS = 'presentations', + CREDENTIALS = 'credentials', +} + export enum VerificationProcessState { PROPOSAL_SENT = 'proposal-sent', PROPOSAL_RECEIVED = 'proposal-received',