Merged PR 425: 親アカウント名表示修正

## 概要
[Task2687: 親アカウント名表示修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2687)

アカウント情報画面の親アカウント名表示対応を実施

## レビューポイント
なし

## UIの変更
なし

## 動作確認状況
ローカルで確認

## 補足
なし
This commit is contained in:
oura.a 2023-09-20 02:34:02 +00:00
parent 75393d683d
commit e7bd7b52fa
6 changed files with 29 additions and 9 deletions

View File

@ -90,6 +90,12 @@ export interface Account {
* @memberof Account
*/
'secondryAdminUserId'?: number;
/**
*
* @type {string}
* @memberof Account
*/
'parentAccountName'?: string;
}
/**
*

View File

@ -124,7 +124,7 @@ const AccountPage: React.FC = (): JSX.Element => {
</dt>
<dd>{viewInfo.account.country}</dd>
<dt>{t(getTranslationID("accountPage.label.yourDealer"))}</dt>
{isTier5 && !viewInfo.account.parentAccountId && (
{isTier5 && !viewInfo.account.parentAccountName && (
<dd className={styles.form}>
<select
className={`${styles.formInput} ${styles.required}`}
@ -154,12 +154,8 @@ const AccountPage: React.FC = (): JSX.Element => {
</select>
</dd>
)}
{(!isTier5 || viewInfo.account.parentAccountId) && (
<dd>
{dealers.find(
(x) => x.id === viewInfo.account.parentAccountId
)?.name || "-"}
</dd>
{(!isTier5 || viewInfo.account.parentAccountName) && (
<dd>{viewInfo.account.parentAccountName ?? "-"}</dd>
)}
<dt>
{t(getTranslationID("accountPage.label.dealerManagement"))}

View File

@ -2975,7 +2975,8 @@
"parentAccountId": { "type": "number" },
"delegationPermission": { "type": "boolean" },
"primaryAdminUserId": { "type": "number" },
"secondryAdminUserId": { "type": "number" }
"secondryAdminUserId": { "type": "number" },
"parentAccountName": { "type": "string" }
},
"required": [
"accountId",

View File

@ -5166,9 +5166,12 @@ describe('getAccountInfo', () => {
});
it('パラメータのユーザに対応するアカウント情報を取得できる', async () => {
const module = await makeTestingModule(source);
const { tier4Accounts: tier4Accounts } = await makeHierarchicalAccounts(
source,
);
// 第五階層のアカウント作成
const { account, admin } = await makeTestAccount(source, {
parent_account_id: 123,
parent_account_id: tier4Accounts[0].account.id,
});
const service = module.get<AccountsService>(AccountsService);
@ -5195,6 +5198,9 @@ describe('getAccountInfo', () => {
);
expect(accountResponse.account.secondryAdminUserId).toBe(undefined);
expect(accountResponse.account.tier).toBe(account.tier);
expect(accountResponse.account.parentAccountName).toBe(
tier4Accounts[0].account.company_name,
);
}
});
});

View File

@ -388,6 +388,13 @@ export class AccountsService {
userInfo.account_id,
);
let parentInfo: Account;
if (accountInfo.parent_account_id) {
parentInfo = await this.accountRepository.findAccountById(
accountInfo.parent_account_id,
);
}
return {
account: {
accountId: userInfo.account_id,
@ -398,6 +405,7 @@ export class AccountsService {
delegationPermission: accountInfo.delegation_permission,
primaryAdminUserId: accountInfo.primary_admin_user_id ?? undefined,
secondryAdminUserId: accountInfo.secondary_admin_user_id ?? undefined,
parentAccountName: parentInfo ? parentInfo.company_name : undefined,
},
};
} catch (e) {

View File

@ -124,6 +124,9 @@ export class Account {
@ApiProperty({ required: false })
secondryAdminUserId?: number | undefined;
@ApiProperty({ required: false })
parentAccountName?: string | undefined;
}
export class GetMyAccountResponse {