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 {