From e228d06cc7461f6d8012fd8a9e7267090f1df0f4 Mon Sep 17 00:00:00 2001 From: "makabe.t" Date: Fri, 10 Nov 2023 08:09:09 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20571:=20=E3=82=A2=E3=82=AB?= =?UTF-8?q?=E3=82=A6=E3=83=B3=E3=83=88=E7=94=BB=E9=9D=A2=E3=81=A7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=80=85=E8=A8=AD=E5=AE=9A=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=82=8B=E7=AE=87=E6=89=80=E3=81=AE=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task3054: アカウント画面で管理者設定している箇所の対応](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3054) - アカウント画面での管理者設定でEmail認証していないユーザーを設定しないように対応しました。 - 管理者選択のドロップダウンに表示されるユーザーをクライアント側で認証済みでフィルタする対応 - アカウント情報更新APIで管理者に未認証ユーザーを設定しようとするとエラーとなるように修正 ## レビューポイント - ユーザー取得は画面側でフィルタしているが対応としては適切でしょうか? - 同じAPIをフィルタせずに使うところもあるため ## UIの変更 - なし ## 動作確認状況 - ローカルで確認 --- dictation_client/src/features/account/selectors.ts | 5 +++-- dictation_client/src/features/login/operations.ts | 2 +- .../repositories/accounts/accounts.repository.service.ts | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dictation_client/src/features/account/selectors.ts b/dictation_client/src/features/account/selectors.ts index 23a0bfe..e99fdc1 100644 --- a/dictation_client/src/features/account/selectors.ts +++ b/dictation_client/src/features/account/selectors.ts @@ -1,4 +1,4 @@ -import { Dealer } from "api/api"; +import { Dealer, User } from "api/api"; import { RootState } from "app/store"; export const selectAccountInfo = (state: RootState) => @@ -10,7 +10,8 @@ export const selectDealers = (state: RootState) => { const { country } = state.account.domain.getAccountInfo.account; 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) => state.account.apps.isLoading; export const selectUpdateAccountInfo = (state: RootState) => diff --git a/dictation_client/src/features/login/operations.ts b/dictation_client/src/features/login/operations.ts index ffbf4e9..cc7c65c 100644 --- a/dictation_client/src/features/login/operations.ts +++ b/dictation_client/src/features/login/operations.ts @@ -1,6 +1,6 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import type { RootState } from "app/store"; -import { getAccessToken, setToken } from "features/auth"; +import { setToken } from "features/auth"; import { AuthApi, UsersApi, diff --git a/dictation_server/src/repositories/accounts/accounts.repository.service.ts b/dictation_server/src/repositories/accounts/accounts.repository.service.ts index 65fe99d..8380461 100644 --- a/dictation_server/src/repositories/accounts/accounts.repository.service.ts +++ b/dictation_server/src/repositories/accounts/accounts.repository.service.ts @@ -886,11 +886,12 @@ export class AccountsRepositoryService { where: { id: primaryAdminUserId, account_id: myAccountId, + email_verified: true, }, }); if (!primaryAdminUser) { 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: { id: secondryAdminUserId, account_id: myAccountId, + email_verified: true, }, }); if (!secondryAdminUser) { 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}`, ); } }