Merged PR 571: アカウント画面で管理者設定している箇所の対応

## 概要
[Task3054: アカウント画面で管理者設定している箇所の対応](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3054)

- アカウント画面での管理者設定でEmail認証していないユーザーを設定しないように対応しました。
  - 管理者選択のドロップダウンに表示されるユーザーをクライアント側で認証済みでフィルタする対応
  - アカウント情報更新APIで管理者に未認証ユーザーを設定しようとするとエラーとなるように修正

## レビューポイント
- ユーザー取得は画面側でフィルタしているが対応としては適切でしょうか?
  - 同じAPIをフィルタせずに使うところもあるため

## UIの変更
- なし

## 動作確認状況
- ローカルで確認
This commit is contained in:
makabe.t 2023-11-10 08:09:09 +00:00
parent 7c16e7c358
commit e228d06cc7
3 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import { Dealer } from "api/api"; import { Dealer, User } from "api/api";
import { RootState } from "app/store"; import { RootState } from "app/store";
export const selectAccountInfo = (state: RootState) => export const selectAccountInfo = (state: RootState) =>
@ -10,7 +10,8 @@ export const selectDealers = (state: RootState) => {
const { country } = state.account.domain.getAccountInfo.account; const { country } = state.account.domain.getAccountInfo.account;
return dealers.filter((x: Dealer) => x.country === country); return dealers.filter((x: Dealer) => x.country === country);
}; };
export const selectUsers = (state: RootState) => state.account.domain.users; export const selectUsers = (state: RootState) =>
state.account.domain.users.filter((x: User) => x.emailVerified);
export const selectIsLoading = (state: RootState) => export const selectIsLoading = (state: RootState) =>
state.account.apps.isLoading; state.account.apps.isLoading;
export const selectUpdateAccountInfo = (state: RootState) => export const selectUpdateAccountInfo = (state: RootState) =>

View File

@ -1,6 +1,6 @@
import { createAsyncThunk } from "@reduxjs/toolkit"; import { createAsyncThunk } from "@reduxjs/toolkit";
import type { RootState } from "app/store"; import type { RootState } from "app/store";
import { getAccessToken, setToken } from "features/auth"; import { setToken } from "features/auth";
import { import {
AuthApi, AuthApi,
UsersApi, UsersApi,

View File

@ -886,11 +886,12 @@ export class AccountsRepositoryService {
where: { where: {
id: primaryAdminUserId, id: primaryAdminUserId,
account_id: myAccountId, account_id: myAccountId,
email_verified: true,
}, },
}); });
if (!primaryAdminUser) { if (!primaryAdminUser) {
throw new AdminUserNotFoundError( throw new AdminUserNotFoundError(
`Primary admin user is not found. id: ${primaryAdminUserId}, account_id: ${myAccountId}`, `Primary admin user is not found or email not verified. id: ${primaryAdminUserId}, account_id: ${myAccountId}`,
); );
} }
} }
@ -901,11 +902,12 @@ export class AccountsRepositoryService {
where: { where: {
id: secondryAdminUserId, id: secondryAdminUserId,
account_id: myAccountId, account_id: myAccountId,
email_verified: true,
}, },
}); });
if (!secondryAdminUser) { if (!secondryAdminUser) {
throw new AdminUserNotFoundError( throw new AdminUserNotFoundError(
`Secondry admin user is not found. id: ${secondryAdminUserId}, account_id: ${myAccountId}`, `Secondary admin user is not found or email not verified. id: ${secondryAdminUserId}, account_id: ${myAccountId}`,
); );
} }
} }