From 378b9adf4d5f97332dcf0b708328d1ac44726762 Mon Sep 17 00:00:00 2001 From: Kallesh B S Date: Wed, 30 Apr 2025 17:28:09 +0530 Subject: [PATCH] released connection --- src/oracle/home-page/home-page.service.ts | 45 ++++ .../manage-clients/manage-clients.service.ts | 90 ++++++++ src/oracle/manage-fee/manage-fee.service.ts | 192 +++++++++++++++++- .../manage-holders/manage-holders.service.ts | 99 ++++++++- src/oracle/param-table/param-table.service.ts | 54 +++++ .../carnet-sequence.service.ts | 18 ++ .../uscib-managed-sp/region/region.service.ts | 18 ++ .../sp-contacts/sp-contacts.service.ts | 54 +++++ src/oracle/uscib-managed-sp/sp/sp.service.ts | 36 ++++ 9 files changed, 596 insertions(+), 10 deletions(-) diff --git a/src/oracle/home-page/home-page.service.ts b/src/oracle/home-page/home-page.service.ts index 93529c9..6222ab3 100644 --- a/src/oracle/home-page/home-page.service.ts +++ b/src/oracle/home-page/home-page.service.ts @@ -281,6 +281,15 @@ export class HomePageService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GetCarnetSummaryData(p_emailaddr: string) { @@ -372,6 +381,15 @@ export class HomePageService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async SaveCarnetApplication(body: SaveCarnetApplicationDTO) { @@ -707,6 +725,15 @@ export class HomePageService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) { @@ -775,6 +802,15 @@ export class HomePageService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GetCarnetDetailsbyCarnetStatus( @@ -837,5 +873,14 @@ export class HomePageService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } } diff --git a/src/oracle/manage-clients/manage-clients.service.ts b/src/oracle/manage-clients/manage-clients.service.ts index 1018cbc..ec200c6 100644 --- a/src/oracle/manage-clients/manage-clients.service.ts +++ b/src/oracle/manage-clients/manage-clients.service.ts @@ -339,6 +339,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; UpdateClient = async (body: UpdateClientDTO) => { @@ -477,6 +486,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; UpdateClientContacts = async (body: UpdateClientContactsDTO) => { @@ -615,6 +633,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; UpdateClientLocations = async (body: UpdateClientLocationsDTO) => { @@ -747,6 +774,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; CreateClientContact = async (body: CreateAdditionalClientContactsDTO) => { @@ -909,6 +945,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; CreateClientLocation = async (body: CreateAdditionalClientLocationsDTO) => { @@ -1069,6 +1114,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; GetPreparers = async (body: GetPreparersDTO) => { @@ -1187,6 +1241,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; GetPreparerByClientid = async ( @@ -1248,6 +1311,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; GetPreparerContactsByClientid = async ( @@ -1309,6 +1381,15 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; GetPreparerLocByClientid = async ( @@ -1370,5 +1451,14 @@ export class ManageClientsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; } diff --git a/src/oracle/manage-fee/manage-fee.service.ts b/src/oracle/manage-fee/manage-fee.service.ts index df6ca6a..876a35f 100644 --- a/src/oracle/manage-fee/manage-fee.service.ts +++ b/src/oracle/manage-fee/manage-fee.service.ts @@ -21,7 +21,7 @@ import { @Injectable() export class ManageFeeService { - constructor(private readonly oracleDBService: OracleDBService) {} + constructor(private readonly oracleDBService: OracleDBService) { } // get @@ -80,6 +80,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GETBONDRATES(body: GetFeeGeneralDTO) { let connection; @@ -135,6 +144,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GETCARGORATES(body: GetFeeGeneralDTO) { let connection; @@ -190,6 +208,16 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } + } async GETCFFEERATES(body: GetFeeGeneralDTO) { let connection; @@ -245,6 +273,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GETCSFEERATES(body: GetFeeGeneralDTO) { let connection; @@ -300,6 +337,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GETEFFEERATES(body: GetFeeGeneralDTO) { let connection; @@ -355,6 +401,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async GETFEECOMM(body: GetFeeGeneralDTO) { let connection; @@ -410,6 +465,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } // post @@ -480,6 +544,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATEBONDRATE(body: CreateBondRateDTO) { let connection; @@ -556,6 +629,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATECARGORATE(body: CreateCargoRateDTO) { let connection; @@ -627,6 +709,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATECFFEE(body: CreateCfFeeDTO) { let connection; @@ -703,6 +794,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATECSFEE(body: CreateCsFeeDTO) { let connection; @@ -769,6 +869,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATEEFFEE(body: CreateEfFeeDTO) { let connection; @@ -850,6 +959,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATEFEECOMM(body: CreateFeeCommDTO) { let connection; @@ -911,6 +1029,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } // update @@ -970,6 +1097,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATEBONDRATE(body: UpdateBondRateDTO) { let connection; @@ -1026,6 +1162,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATECARGORATE(body: UpdateCargoRateDTO) { let connection; @@ -1082,6 +1227,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATECFFEE(body: UpdateCfFeeDTO) { let connection; @@ -1138,6 +1292,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATECSFEE(body: UpdateCsFeeDTO) { let connection; @@ -1194,6 +1357,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATEEFFEE(body: UpdateEfFeeDTO) { let connection; @@ -1250,6 +1422,15 @@ export class ManageFeeService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATEFEECOMM(body: UpdateFeeCommBodyDTO) { let connection; @@ -1310,5 +1491,14 @@ export class ManageFeeService { return { error: err.message }; // return {error: err.message} } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } } diff --git a/src/oracle/manage-holders/manage-holders.service.ts b/src/oracle/manage-holders/manage-holders.service.ts index 127ecaa..15ae281 100644 --- a/src/oracle/manage-holders/manage-holders.service.ts +++ b/src/oracle/manage-holders/manage-holders.service.ts @@ -53,7 +53,7 @@ export class ManageHoldersService { const finalBody: CreateHoldersDTO = { ...newBody, ...reqBody }; - let connection: Connection; + let connection: Connection | undefined = undefined; let p_holdercursor_rows = []; let p_holdercontactcursor_rows = []; try { @@ -282,6 +282,15 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; UpdateHolder = async (body: UpdateHolderDTO) => { const newBody = { @@ -320,7 +329,7 @@ export class ManageHoldersService { const finalBody = { ...newBody, ...reqBody }; - let connection: Connection; + let connection: Connection | undefined = undefined; let P_cursor_rows = []; try { connection = await this.oracleDBService.getConnection(); @@ -459,9 +468,18 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; GetHolderRecord = async (body: GetHolderDTO) => { - let connection: Connection; + let connection: Connection | undefined = undefined; let p_cursor_rows = []; try { @@ -517,6 +535,15 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; UpdateHolderContact = async (body: UpdateHolderContactDTO) => { const newBody = { @@ -549,7 +576,7 @@ export class ManageHoldersService { const finalBody: UpdateHolderContactDTO = { ...newBody, ...reqBody }; - let connection: Connection; + let connection: Connection | undefined = undefined; let P_cursor_rows = []; try { connection = await this.oracleDBService.getConnection(); @@ -658,9 +685,18 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; GetHolderContacts = async (body: GetHolderDTO) => { - let connection: Connection; + let connection: Connection | undefined = undefined; let p_cursor_rows = []; try { @@ -716,9 +752,18 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; InactivateHolder = async (body: HolderActivateOrInactivateDTO) => { - let connection: Connection; + let connection: Connection | undefined = undefined; let p_cursor_rows = []; try { @@ -779,9 +824,18 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; ReactivateHolder = async (body: HolderActivateOrInactivateDTO) => { - let connection: Connection; + let connection: Connection | undefined = undefined; let p_cursor_rows = []; try { @@ -842,9 +896,18 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; InactivateHolderContact = async (body: HolderContactActivateOrInactivateDTO) => { - let connection: Connection; + let connection: Connection | undefined = undefined; let p_cursor_rows = []; try { @@ -905,9 +968,18 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; ReactivateHolderContact = async (body: HolderContactActivateOrInactivateDTO) => { - let connection: Connection; + let connection: Connection | undefined = undefined; let p_cursor_rows = []; try { @@ -968,5 +1040,14 @@ export class ManageHoldersService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } }; } diff --git a/src/oracle/param-table/param-table.service.ts b/src/oracle/param-table/param-table.service.ts index 7034647..0aa0e8e 100644 --- a/src/oracle/param-table/param-table.service.ts +++ b/src/oracle/param-table/param-table.service.ts @@ -72,6 +72,15 @@ export class ParamTableService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATETABLERECORD(body: CreateTableRecordDTO) { @@ -117,6 +126,15 @@ export class ParamTableService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async CREATEPARAMRECORD(body: CreateParamRecordDTO) { @@ -210,6 +228,15 @@ export class ParamTableService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) { @@ -298,6 +325,15 @@ export class ParamTableService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) { @@ -335,6 +371,15 @@ export class ParamTableService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) { @@ -372,5 +417,14 @@ export class ParamTableService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } } diff --git a/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts b/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts index a4ffc36..dee398c 100644 --- a/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts +++ b/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts @@ -73,6 +73,15 @@ export class CarnetSequenceService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async getCarnetSequence(body: GetCarnetSequenceDTO) { @@ -126,5 +135,14 @@ export class CarnetSequenceService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } } diff --git a/src/oracle/uscib-managed-sp/region/region.service.ts b/src/oracle/uscib-managed-sp/region/region.service.ts index 5692a04..97302fd 100644 --- a/src/oracle/uscib-managed-sp/region/region.service.ts +++ b/src/oracle/uscib-managed-sp/region/region.service.ts @@ -50,6 +50,15 @@ export class RegionService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async updateRegions(body: UpdateRegionDto) { @@ -95,6 +104,15 @@ export class RegionService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async getRegions() { diff --git a/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts b/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts index a2c69f9..6fa7d00 100644 --- a/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts +++ b/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts @@ -105,6 +105,15 @@ export class SpContactsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async setSPDefaultcontact(body: setSPDefaultcontactDTO) { @@ -137,6 +146,15 @@ export class SpContactsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async updateSPContacts(body: UpdateSPContactsDTO) { @@ -225,6 +243,15 @@ export class SpContactsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async inactivateSPContact(body: inactivateSPContactDTO) { @@ -257,6 +284,15 @@ export class SpContactsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async getSPDefaultcontacts(body: getSPDefaultcontactDTO) { @@ -309,6 +345,15 @@ export class SpContactsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async getSPAllContacts(body: getSPAllContactsDTO) { @@ -362,5 +407,14 @@ export class SpContactsService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } } diff --git a/src/oracle/uscib-managed-sp/sp/sp.service.ts b/src/oracle/uscib-managed-sp/sp/sp.service.ts index 85777d0..ebf06dc 100644 --- a/src/oracle/uscib-managed-sp/sp/sp.service.ts +++ b/src/oracle/uscib-managed-sp/sp/sp.service.ts @@ -127,6 +127,15 @@ export class SpService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async updateServiceProvider(body: UpdateServiceProviderDTO) { @@ -250,6 +259,15 @@ export class SpService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async getAllServiceproviders() { @@ -298,6 +316,15 @@ export class SpService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } async getServiceproviderByID(body: getSelectedServiceproviderDTO) { @@ -350,5 +377,14 @@ export class SpService { return { error: 'An unknown error occurred' }; } } + finally { + if (connection) { + try { + await connection.close(); + } catch (closeErr) { + console.error('Failed to close connection:', closeErr); + } + } + } } }