From e7bd7b52fa74f085db60bdede4cfc5e7aa83e011 Mon Sep 17 00:00:00 2001 From: "oura.a" Date: Wed, 20 Sep 2023 02:34:02 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20425:=20=E8=A6=AA=E3=82=A2?= =?UTF-8?q?=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88=E5=90=8D=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2687: 親アカウント名表示修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2687) アカウント情報画面の親アカウント名表示対応を実施 ## レビューポイント なし ## UIの変更 なし ## 動作確認状況 ローカルで確認 ## 補足 なし --- dictation_client/src/api/api.ts | 6 ++++++ dictation_client/src/pages/AccountPage/index.tsx | 10 +++------- dictation_server/src/api/odms/openapi.json | 3 ++- .../src/features/accounts/accounts.service.spec.ts | 8 +++++++- .../src/features/accounts/accounts.service.ts | 8 ++++++++ dictation_server/src/features/accounts/types/types.ts | 3 +++ 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/dictation_client/src/api/api.ts b/dictation_client/src/api/api.ts index 6ceb8e6..2c44b9f 100644 --- a/dictation_client/src/api/api.ts +++ b/dictation_client/src/api/api.ts @@ -90,6 +90,12 @@ export interface Account { * @memberof Account */ 'secondryAdminUserId'?: number; + /** + * + * @type {string} + * @memberof Account + */ + 'parentAccountName'?: string; } /** * diff --git a/dictation_client/src/pages/AccountPage/index.tsx b/dictation_client/src/pages/AccountPage/index.tsx index 771a92e..402e044 100644 --- a/dictation_client/src/pages/AccountPage/index.tsx +++ b/dictation_client/src/pages/AccountPage/index.tsx @@ -124,7 +124,7 @@ const AccountPage: React.FC = (): JSX.Element => {
{viewInfo.account.country}
{t(getTranslationID("accountPage.label.yourDealer"))}
- {isTier5 && !viewInfo.account.parentAccountId && ( + {isTier5 && !viewInfo.account.parentAccountName && (
)} - {(!isTier5 || viewInfo.account.parentAccountId) && ( -
- {dealers.find( - (x) => x.id === viewInfo.account.parentAccountId - )?.name || "-"} -
+ {(!isTier5 || viewInfo.account.parentAccountName) && ( +
{viewInfo.account.parentAccountName ?? "-"}
)}
{t(getTranslationID("accountPage.label.dealerManagement"))} diff --git a/dictation_server/src/api/odms/openapi.json b/dictation_server/src/api/odms/openapi.json index 7f63f9e..52874b9 100644 --- a/dictation_server/src/api/odms/openapi.json +++ b/dictation_server/src/api/odms/openapi.json @@ -2975,7 +2975,8 @@ "parentAccountId": { "type": "number" }, "delegationPermission": { "type": "boolean" }, "primaryAdminUserId": { "type": "number" }, - "secondryAdminUserId": { "type": "number" } + "secondryAdminUserId": { "type": "number" }, + "parentAccountName": { "type": "string" } }, "required": [ "accountId", diff --git a/dictation_server/src/features/accounts/accounts.service.spec.ts b/dictation_server/src/features/accounts/accounts.service.spec.ts index 6607a87..7fe4171 100644 --- a/dictation_server/src/features/accounts/accounts.service.spec.ts +++ b/dictation_server/src/features/accounts/accounts.service.spec.ts @@ -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); @@ -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, + ); } }); }); diff --git a/dictation_server/src/features/accounts/accounts.service.ts b/dictation_server/src/features/accounts/accounts.service.ts index 401bae4..2c13616 100644 --- a/dictation_server/src/features/accounts/accounts.service.ts +++ b/dictation_server/src/features/accounts/accounts.service.ts @@ -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) { diff --git a/dictation_server/src/features/accounts/types/types.ts b/dictation_server/src/features/accounts/types/types.ts index f9675a0..16d2ed8 100644 --- a/dictation_server/src/features/accounts/types/types.ts +++ b/dictation_server/src/features/accounts/types/types.ts @@ -124,6 +124,9 @@ export class Account { @ApiProperty({ required: false }) secondryAdminUserId?: number | undefined; + + @ApiProperty({ required: false }) + parentAccountName?: string | undefined; } export class GetMyAccountResponse {