/* import { ApplicationServiceError, type IApplicationServiceError, } from "@/contexts/common/application/services/ApplicationServiceError"; import { IAdapter, RepositoryBuilder } from "@/contexts/common/domain"; import { Result, UniqueID } from "@shared/contexts"; import { NullOr } from "@shared/utilities"; import { ICustomerParticipantAddress, ICustomerParticipantAddressRepository } from "../../domain"; export const participantAddressFinder = async ( addressId: UniqueID, adapter: IAdapter, repository: RepositoryBuilder ) => { if (addressId.isNull()) { return Result.fail( ApplicationServiceError.create( ApplicationServiceError.INVALID_REQUEST_PARAM, `Participant address ID required` ) ); } const transaction = adapter.startTransaction(); let address: NullOr = null; try { await transaction.complete(async (t) => { address = await repository({ transaction: t }).getById(addressId); }); if (address === null) { return Result.fail( ApplicationServiceError.create(ApplicationServiceError.NOT_FOUND_ERROR, "", { id: addressId.toString(), entity: "participant address", }) ); } return Result.ok(address); } catch (error: unknown) { const _error = error as Error; if (repository().isRepositoryError(_error)) { return Result.fail( ApplicationServiceError.create( ApplicationServiceError.REPOSITORY_ERROR, _error.message, _error ) ); } return Result.fail( ApplicationServiceError.create( ApplicationServiceError.UNEXCEPTED_ERROR, _error.message, _error ) ); } }; */