Skip to content

Commit

Permalink
fix: ORV2-2353 Credit Account User ordering and feature flag (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
praju-aot authored Jun 26, 2024
1 parent 0652985 commit 40bf970
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
10 changes: 10 additions & 0 deletions database/mssql/scripts/sampledata/dbo.ORBC_FEATURE_FLAG.Table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,15 @@ SET IDENTITY_INSERT [dbo].[ORBC_FEATURE_FLAG] ON
,[DB_LAST_UPDATE_TIMESTAMP])
VALUES ('1','CREDIT-ACCOUNT','ENABLED', NULL, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE());

INSERT INTO [dbo].[ORBC_FEATURE_FLAG] ([FEATURE_ID]
,[FEATURE_KEY]
,[FEATURE_VALUE]
,[CONCURRENCY_CONTROL_NUMBER]
,[DB_CREATE_USERID]
,[DB_CREATE_TIMESTAMP]
,[DB_LAST_UPDATE_USERID]
,[DB_LAST_UPDATE_TIMESTAMP])
VALUES ('2','APPLICATION-SEARCH','ENABLED', NULL, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE());

SET IDENTITY_INSERT [dbo].[ORBC_FEATURE_FLAG] OFF
GO
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const SearchFilter = ({
value="companies"
control={<Radio key="find-by-company" />}
/>
{featureFlags?.["APPLICATION_SEARCH"] === "ENABLED" && (
{featureFlags?.["APPLICATION-SEARCH"] === "ENABLED" && (
<FormControlLabel
label="Application"
value="applications"
Expand Down
29 changes: 6 additions & 23 deletions vehicles/src/modules/credit-account/credit-account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export class CreditAccountService {
);
}

//TODO Change from exists to find
const companyAlreadyHasCreditAccount =
await this.creditAccountRepository.exists({
where: {
Expand Down Expand Up @@ -798,27 +799,6 @@ export class CreditAccountService {
return await creditAccountUserQB.getMany();
}

/**
* Retrieves credit account users based on account holder and credit account ID.
*
* @param creditAccountHolder - The ID of the account holder.
* @param creditAccountId - The ID of the credit account.
* @returns {Promise<CreditAccountUser[]>} - The found credit account users.
*/
@LogAsyncMethodExecution()
private async getCreditAccountUsersEntity(
creditAccountHolder: number,
creditAccountId: number,
) {
return await this.findManyCreditAccountUsers(
null,
creditAccountHolder,
creditAccountId,
null,
true,
);
}

/**
* Retrieves credit account users based on account holder and credit account ID.
*
Expand All @@ -833,9 +813,12 @@ export class CreditAccountService {
creditAccountId: number,
includeAccountHolder?: Nullable<boolean>,
): Promise<ReadCreditAccountUserDto[]> {
const creditAccountUsers = await this.getCreditAccountUsersEntity(
const creditAccountUsers = await this.findManyCreditAccountUsers(
null,
creditAccountHolder,
creditAccountId,
null,
true,
);

const readCreditAccountUserDtoList = await this.classMapper.mapArrayAsync(
Expand All @@ -854,7 +837,7 @@ export class CreditAccountService {
ReadCreditAccountUserDto,
);

readCreditAccountUserDtoList.push(mappedCreditAccountHolderInfo);
readCreditAccountUserDtoList.unshift(mappedCreditAccountHolderInfo);
}
return readCreditAccountUserDtoList;
}
Expand Down

0 comments on commit 40bf970

Please sign in to comment.