diff --git a/dictation_client/codegen.sh b/dictation_client/codegen.sh index 5d09ae3..d165c0c 100644 --- a/dictation_client/codegen.sh +++ b/dictation_client/codegen.sh @@ -1,2 +1,2 @@ -npx openapi-generator-cli version-manager set latest +npx openapi-generator-cli version-manager set 7.1.0 npx openapi-generator-cli generate -g typescript-axios -i /app/dictation_server/src/api/odms/openapi.json -o /app/dictation_client/src/api/ diff --git a/dictation_client/src/api/api.ts b/dictation_client/src/api/api.ts index 1c1ac87..645f058 100644 --- a/dictation_client/src/api/api.ts +++ b/dictation_client/src/api/api.ts @@ -1549,12 +1549,6 @@ export interface PostUpdateUserRequest { * @memberof PostUpdateUserRequest */ 'autoRenew': boolean; - /** - * - * @type {boolean} - * @memberof PostUpdateUserRequest - */ - 'licenseAlart': boolean; /** * * @type {boolean} @@ -1660,12 +1654,6 @@ export interface SignupRequest { * @memberof SignupRequest */ 'autoRenew': boolean; - /** - * - * @type {boolean} - * @memberof SignupRequest - */ - 'licenseAlert': boolean; /** * * @type {boolean} @@ -2212,12 +2200,6 @@ export interface User { * @memberof User */ 'autoRenew': boolean; - /** - * - * @type {boolean} - * @memberof User - */ - 'licenseAlert': boolean; /** * * @type {boolean} diff --git a/dictation_client/src/components/header/notLoginHeader.tsx b/dictation_client/src/components/header/notLoginHeader.tsx index 09cdcd6..67c71cc 100644 --- a/dictation_client/src/components/header/notLoginHeader.tsx +++ b/dictation_client/src/components/header/notLoginHeader.tsx @@ -1,7 +1,5 @@ import React from "react"; import styles from "styles/app.module.scss"; - -import { useTranslation } from "react-i18next"; import logo from "../../assets/images/OMS_logo_black.svg"; import { HEADER_NAME } from "./constants"; @@ -13,7 +11,6 @@ const NotLoginHeader: React.FC = ( props: NotLoginHeaderProps ) => { const { isMobile } = props; - const { t } = useTranslation(); return (
diff --git a/dictation_client/src/features/dictation/constants.ts b/dictation_client/src/features/dictation/constants.ts index d699a54..69eae60 100644 --- a/dictation_client/src/features/dictation/constants.ts +++ b/dictation_client/src/features/dictation/constants.ts @@ -8,7 +8,7 @@ export const STATUS = { export type StatusType = typeof STATUS[keyof typeof STATUS]; -export const LIMIT_TASK_NUM = 20; +export const LIMIT_TASK_NUM = 100; export const SORTABLE_COLUMN = { JobNumber: "JOB_NUMBER", @@ -99,3 +99,8 @@ export const INIT_DISPLAY_INFO: DisplayInfoType = { export const BACKUP_POPUP_LIST_SIZE = 10; export const BACKUP_POPUP_LIST_STATUS = [STATUS.FINISHED, STATUS.BACKUP]; + +export const PRIORITY = { + NORMAL: "Normal", + HIGH: "High", +} as const; diff --git a/dictation_client/src/features/terms/constants.ts b/dictation_client/src/features/terms/constants.ts index e9cbd2f..d06ba4f 100644 --- a/dictation_client/src/features/terms/constants.ts +++ b/dictation_client/src/features/terms/constants.ts @@ -5,5 +5,6 @@ export const TERMS_DOCUMENT_TYPE = { DPA: "DPA", EULA: "EULA", + // eslint-disable-next-line @typescript-eslint/naming-convention PRIVACY_NOTICE: "PrivacyNotice", } as const; diff --git a/dictation_client/src/features/user/operations.ts b/dictation_client/src/features/user/operations.ts index f02e38c..b7ca2b0 100644 --- a/dictation_client/src/features/user/operations.ts +++ b/dictation_client/src/features/user/operations.ts @@ -164,7 +164,6 @@ export const updateUserAsync = createAsyncThunk< encryptionPassword, prompt, autoRenew: updateUser.autoRenew, - licenseAlart: updateUser.licenseAlert, notification: updateUser.notification, }, { diff --git a/dictation_client/src/features/user/selectors.ts b/dictation_client/src/features/user/selectors.ts index e1e3cf1..ee1f3fa 100644 --- a/dictation_client/src/features/user/selectors.ts +++ b/dictation_client/src/features/user/selectors.ts @@ -131,8 +131,6 @@ export const selectAuthorId = (state: RootState) => state.user.apps.addUser.authorId; export const selectAutoRenew = (state: RootState) => state.user.apps.addUser.autoRenew; -export const selectLicenseAlert = (state: RootState) => - state.user.apps.addUser.licenseAlert; export const selectNotification = (state: RootState) => state.user.apps.addUser.notification; // AddUserを返却する diff --git a/dictation_client/src/features/user/types.ts b/dictation_client/src/features/user/types.ts index 7f41187..649b63f 100644 --- a/dictation_client/src/features/user/types.ts +++ b/dictation_client/src/features/user/types.ts @@ -16,7 +16,6 @@ export interface UserView encryption: boolean | string; emailVerified: boolean; autoRenew: boolean; - licenseAlert: boolean; notification: boolean; name: string; email: string; @@ -28,7 +27,6 @@ export interface AddUser { role: RoleType; email: string; autoRenew: boolean; - licenseAlert: boolean; notification: boolean; authorId?: string; encryption?: boolean; @@ -46,7 +44,6 @@ export interface UpdateUser { encryptionPassword?: string | undefined; prompt?: boolean | undefined; autoRenew: boolean; - licenseAlert: boolean; notification: boolean; } diff --git a/dictation_client/src/features/user/userSlice.ts b/dictation_client/src/features/user/userSlice.ts index 52ffbc4..ef0589a 100644 --- a/dictation_client/src/features/user/userSlice.ts +++ b/dictation_client/src/features/user/userSlice.ts @@ -23,7 +23,6 @@ const initialState: UsersState = { encryptionPassword: undefined, prompt: undefined, autoRenew: true, - licenseAlert: true, notification: true, }, selectedUser: { @@ -36,7 +35,6 @@ const initialState: UsersState = { encryptionPassword: undefined, prompt: undefined, autoRenew: true, - licenseAlert: true, notification: true, }, addUser: { @@ -44,7 +42,6 @@ const initialState: UsersState = { role: USER_ROLES.NONE, email: "", autoRenew: true, - licenseAlert: true, notification: true, authorId: undefined, encryption: false, @@ -93,13 +90,6 @@ export const userSlice = createSlice({ const { autoRenew } = action.payload; state.apps.addUser.autoRenew = autoRenew; }, - changeLicenseAlert: ( - state, - action: PayloadAction<{ licenseAlert: boolean }> - ) => { - const { licenseAlert } = action.payload; - state.apps.addUser.licenseAlert = licenseAlert; - }, changeEncryption: ( state, action: PayloadAction<{ encryption: boolean }> @@ -149,7 +139,6 @@ export const userSlice = createSlice({ state.apps.updateUser.encryptionPassword = undefined; state.apps.updateUser.prompt = user.prompt; state.apps.updateUser.autoRenew = user.autoRenew; - state.apps.updateUser.licenseAlert = user.licenseAlert; state.apps.updateUser.notification = user.notification; state.apps.selectedUser.id = user.id; @@ -161,7 +150,6 @@ export const userSlice = createSlice({ state.apps.selectedUser.encryptionPassword = undefined; state.apps.selectedUser.prompt = user.prompt; state.apps.selectedUser.autoRenew = user.autoRenew; - state.apps.selectedUser.licenseAlert = user.licenseAlert; state.apps.selectedUser.notification = user.notification; state.apps.hasPasswordMask = user.encryption; @@ -211,13 +199,6 @@ export const userSlice = createSlice({ const { autoRenew } = action.payload; state.apps.updateUser.autoRenew = autoRenew; }, - changeUpdateLicenseAlert: ( - state, - action: PayloadAction<{ licenseAlert: boolean }> - ) => { - const { licenseAlert } = action.payload; - state.apps.updateUser.licenseAlert = licenseAlert; - }, changeUpdateNotification: ( state, action: PayloadAction<{ notification: boolean }> @@ -318,7 +299,6 @@ export const { changeRole, changeAuthorId, changeAutoRenew, - changeLicenseAlert, changeNotification, cleanupAddUser, changeUpdateUser, @@ -328,7 +308,6 @@ export const { changeUpdateEncryptionPassword, changeUpdatePrompt, changeUpdateAutoRenew, - changeUpdateLicenseAlert, changeUpdateNotification, cleanupUpdateUser, changeEncryption, diff --git a/dictation_client/src/pages/AccountPage/index.tsx b/dictation_client/src/pages/AccountPage/index.tsx index 79963ae..6fd0877 100644 --- a/dictation_client/src/pages/AccountPage/index.tsx +++ b/dictation_client/src/pages/AccountPage/index.tsx @@ -102,6 +102,7 @@ const AccountPage: React.FC = (): JSX.Element => {
+ {/* File Delete Setting は現状不要のため非表示 + */}
diff --git a/dictation_client/src/pages/AuthPage/index.tsx b/dictation_client/src/pages/AuthPage/index.tsx index a1559bd..e8d81f9 100644 --- a/dictation_client/src/pages/AuthPage/index.tsx +++ b/dictation_client/src/pages/AuthPage/index.tsx @@ -10,6 +10,14 @@ import { import React, { useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; import { useNavigate } from "react-router-dom"; +import { + clearToken, + isAdminUser, + isApproveTier, + isStandardUser, + loadAccessToken, +} from "features/auth"; +import { TIERS } from "components/auth/constants"; const AuthPage: React.FC = (): JSX.Element => { const { instance } = useMsal(); @@ -26,11 +34,39 @@ const AuthPage: React.FC = (): JSX.Element => { (async () => { try { + // ログイン済みの場合、ログイン後の遷移先を決定する + if (loadAccessToken()) { + // 第一~第四階層の管理者はライセンス画面へ遷移 + if ( + isApproveTier([ + TIERS.TIER1, + TIERS.TIER2, + TIERS.TIER3, + TIERS.TIER4, + ]) && + isAdminUser() + ) { + navigate("/license"); + return; + } + // 第五階層の管理者はユーザー画面へ遷移 + if (isApproveTier([TIERS.TIER5]) && isAdminUser()) { + navigate("/user"); + return; + } + // 一般ユーザーはdictationPageへ遷移 + if (isStandardUser()) { + navigate("/dictations"); + return; + } + // それ以外は認証エラー画面へ遷移 + instance.logoutRedirect({ + postLogoutRedirectUri: "/AuthError", + }); + clearToken(); + return; + } const loginResult = await instance.handleRedirectPromise(); - - // eslint-disable-next-line - console.log({ loginResult }); // TODO:loading画面から遷移できない事象の調査用ログ。事象解消後削除(eslint-disable含めて)する。 - if (loginResult && loginResult.account) { const { homeAccountId, idTokenClaims } = loginResult.account; if (idTokenClaims && idTokenClaims.aud) { @@ -44,11 +80,11 @@ const AuthPage: React.FC = (): JSX.Element => { localStorageKeyforIdToken, }) ); - - // トークン取得と設定を行う - navigate("/login"); } } + // ログインページに遷移し、トークン取得と設定を行う + // 何らかの原因で、loginResultがnullの場合でも、ログイン画面に遷移する(ログイン画面でトップページに戻る) + navigate("/login"); } catch (e) { // eslint-disable-next-line console.log({ e }); // TODO:loading画面から遷移できない事象の調査用ログ。事象解消後削除(eslint-disable含めて)する。 diff --git a/dictation_client/src/pages/DictationPage/filePropertyPopup.tsx b/dictation_client/src/pages/DictationPage/filePropertyPopup.tsx index c0e362d..1a4104c 100644 --- a/dictation_client/src/pages/DictationPage/filePropertyPopup.tsx +++ b/dictation_client/src/pages/DictationPage/filePropertyPopup.tsx @@ -1,7 +1,11 @@ import React, { useCallback } from "react"; import styles from "styles/app.module.scss"; import { useSelector } from "react-redux"; -import { selectSelectedFileTask, selectIsLoading } from "features/dictation"; +import { + selectSelectedFileTask, + selectIsLoading, + PRIORITY, +} from "features/dictation"; import { getTranslationID } from "translation"; import { useTranslation } from "react-i18next"; import close from "../../assets/images/close.svg"; @@ -51,7 +55,11 @@ export const FilePropertyPopup: React.FC = (props) => {
{t(getTranslationID("dictationPage.label.workType"))}
{selectedFileTask?.workType ?? ""}
{t(getTranslationID("dictationPage.label.priority"))}
-
{selectedFileTask?.priority ?? ""}
+
+ {selectedFileTask?.priority === "01" + ? PRIORITY.HIGH + : PRIORITY.NORMAL} +
{t(getTranslationID("dictationPage.label.recordingStartedDate"))}
@@ -114,6 +122,7 @@ export const FilePropertyPopup: React.FC = (props) => {
{t(getTranslationID("dictationPage.label.transcriptionist"))}
{selectedFileTask?.typist?.name ?? ""}
+ {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} close {t(getTranslationID("filePropertyPopup.label.close"))} diff --git a/dictation_client/src/pages/DictationPage/index.tsx b/dictation_client/src/pages/DictationPage/index.tsx index 8cfe9b0..bb70c47 100644 --- a/dictation_client/src/pages/DictationPage/index.tsx +++ b/dictation_client/src/pages/DictationPage/index.tsx @@ -32,6 +32,7 @@ import { selectIsLoading, playbackAsync, cancelAsync, + PRIORITY, } from "features/dictation"; import { getTranslationID } from "translation"; import { Task } from "api/api"; @@ -1148,6 +1149,7 @@ const DictationPage: React.FC = (): JSX.Element => { )} + {/* タスク削除はCCB後回し分なので今は非表示
  • {t( @@ -1156,7 +1158,8 @@ const DictationPage: React.FC = (): JSX.Element => { ) )} -
  • + + */} {displayColumn.JobNumber && ( @@ -1189,7 +1192,9 @@ const DictationPage: React.FC = (): JSX.Element => { )} {displayColumn.Priority && ( - {x.priority === "01" ? "High" : "Normal"} + {x.priority === "01" + ? PRIORITY.HIGH + : PRIORITY.NORMAL} )} {displayColumn.Encryption && ( diff --git a/dictation_client/src/pages/LicensePage/licenseSummary.tsx b/dictation_client/src/pages/LicensePage/licenseSummary.tsx index 058350d..a343fa5 100644 --- a/dictation_client/src/pages/LicensePage/licenseSummary.tsx +++ b/dictation_client/src/pages/LicensePage/licenseSummary.tsx @@ -289,13 +289,17 @@ export const LicenseSummary: React.FC = ( ) )} -
    {licenseSummaryInfo.storageSize}GB
    + {/* Storage Usedの値表示をハイフンに置き換え */} + {/*
    {licenseSummaryInfo.storageSize}GB
    */} +
    -
    {t( getTranslationID("LicenseSummaryPage.label.usedSize") )}
    -
    {licenseSummaryInfo.usedSize}GB
    + {/* Storage Usedの値表示をハイフンに置き換え */} + {/*
    {licenseSummaryInfo.usedSize}GB
    */} +
    -
    {t( getTranslationID( diff --git a/dictation_client/src/pages/LoginPage/index.tsx b/dictation_client/src/pages/LoginPage/index.tsx index e298c40..c335bd3 100644 --- a/dictation_client/src/pages/LoginPage/index.tsx +++ b/dictation_client/src/pages/LoginPage/index.tsx @@ -28,6 +28,33 @@ const LoginPage: React.FC = (): JSX.Element => { selectLocalStorageKeyforIdToken ); + // ログイン後の遷移先を決定する + const navigateToLoginedPage = useCallback(() => { + // 第一~第四階層の管理者はライセンス画面へ遷移 + if ( + isApproveTier([TIERS.TIER1, TIERS.TIER2, TIERS.TIER3, TIERS.TIER4]) && + isAdminUser() + ) { + navigate("/license"); + return; + } + // 第五階層の管理者はユーザー画面へ遷移 + if (isApproveTier([TIERS.TIER5]) && isAdminUser()) { + navigate("/user"); + return; + } + // 一般ユーザーはdictationPageへ遷移 + if (isStandardUser()) { + navigate("/dictations"); + return; + } + // それ以外は認証エラー画面へ遷移 + instance.logoutRedirect({ + postLogoutRedirectUri: "/AuthError", + }); + clearToken(); + }, [instance, navigate]); + const tokenSet = useCallback( async (idToken: string) => { // ログイン処理呼び出し @@ -59,44 +86,36 @@ const LoginPage: React.FC = (): JSX.Element => { document.body.appendChild(a); a.click(); document.body.removeChild(a); - // 第一~第四階層の管理者はライセンス画面へ遷移 - if ( - isApproveTier([TIERS.TIER1, TIERS.TIER2, TIERS.TIER3, TIERS.TIER4]) && - isAdminUser() - ) { - navigate("/license"); - return; - } - // 第五階層の管理者はユーザー画面へ遷移 - if (isApproveTier([TIERS.TIER5]) && isAdminUser()) { - navigate("/user"); - return; - } - // 一般ユーザーはdictationPageへ遷移 - if (isStandardUser()) { - navigate("/dictations"); - return; - } - // それ以外は認証エラー画面へ遷移 - instance.logoutRedirect({ - postLogoutRedirectUri: "/AuthError", - }); - clearToken(); + + // ログイン成功した場合、適切なページに遷移する + navigateToLoginedPage(); } }, - [dispatch, i18n.language, instance, navigate] + [dispatch, i18n.language, instance, navigate, navigateToLoginedPage] ); useEffect(() => { - // AADB2Cのログイン画面とLoginPageを経由していない場合はトップページに遷移する - if (!localStorageKeyforIdToken) { - navigate("/"); - return; - } - + // idTokenStringがあるか⇒認証中 + // accessTokenがある場合⇒ログイン済み + // どちらもなければ直打ち (async () => { - // IDトークンの取得 + if (loadAccessToken()) { + navigateToLoginedPage(); + return; + } + + // AADB2Cのログイン画面とLoginPageを経由していない場合はトップページに遷移する + if (!localStorageKeyforIdToken) { + navigate("/"); + return; + } const idTokenString = localStorage.getItem(localStorageKeyforIdToken); + + if (idTokenString === null) { + navigate("/"); + return; + } + if (idTokenString) { const idTokenObject = JSON.parse(idTokenString); if (isIdToken(idTokenObject)) { diff --git a/dictation_client/src/pages/PartnerPage/index.tsx b/dictation_client/src/pages/PartnerPage/index.tsx index 7f73f66..835cfa3 100644 --- a/dictation_client/src/pages/PartnerPage/index.tsx +++ b/dictation_client/src/pages/PartnerPage/index.tsx @@ -185,6 +185,7 @@ const PartnerPage: React.FC = (): JSX.Element => {
      + {/* パートナーアカウント削除はCCB後回し分なので非表示 {isVisibleButton && (
    • @@ -196,6 +197,7 @@ const PartnerPage: React.FC = (): JSX.Element => {
    • )} + */} {isVisibleDealerManagement && (
    • {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} diff --git a/dictation_client/src/pages/SignupPage/signupInput.tsx b/dictation_client/src/pages/SignupPage/signupInput.tsx index 3f388ce..be83cf7 100644 --- a/dictation_client/src/pages/SignupPage/signupInput.tsx +++ b/dictation_client/src/pages/SignupPage/signupInput.tsx @@ -39,7 +39,11 @@ const SignupInput: React.FC = (): JSX.Element => { const navigate = useNavigate(); const [isPasswordHide, setIsPasswordHide] = useState(true); const [isOpenPolicy, setIsOpenPolicy] = useState(false); - const [isAgreePolicy, setIsAgreePolicy] = useState(false); + const [isOpenPrivacyNotice, setIsOpenPrivacyNoyice] = + useState(false); + const [isCheckedEula, setIsCheckedEula] = useState(false); + const [isCheckedPrivacyNotice, setIsCheckedPrivacyNotice] = + useState(false); const [isPushCreateButton, setIsPushCreateButton] = useState(false); const { hasErrorEmptyAdminName, @@ -90,6 +94,9 @@ const SignupInput: React.FC = (): JSX.Element => { dispatch(getLatestEulaVersionAsync()); }, [dispatch]); + // ボタン押下可否判定ロジック + const canClickButton = () => isCheckedEula && isCheckedPrivacyNotice; + useEffect(() => { // 外部のWebサイトからの遷移時にURLのパラメータを取得 // 以下のようなURLで遷移してきた場合に、Dealerと言語を変更する @@ -371,18 +378,48 @@ const SignupInput: React.FC = (): JSX.Element => { setIsOpenPolicy(true); }} > - {t(getTranslationID("signupPage.label.termsLink"))} + {t(getTranslationID("signupPage.label.linkOfEula"))} - {` ${t(getTranslationID("signupPage.label.termsLinkFor"))} `} + {` ${t(getTranslationID("signupPage.label.forOdms"))} `}
      -
    • )} + {/* ユーザー削除 CCB後回し分なので今は非表示
    • {t( @@ -255,6 +253,7 @@ const UserListPage: React.FC = (): JSX.Element => { )}
    • + */}
    {user.name} @@ -292,7 +291,6 @@ const UserListPage: React.FC = (): JSX.Element => { {boolToElement(user.autoRenew)} - {boolToElement(user.licenseAlert)} {boolToElement(user.notification)} {boolToElement(user.emailVerified)} diff --git a/dictation_client/src/pages/UserListPage/popup.tsx b/dictation_client/src/pages/UserListPage/popup.tsx index 50ed98f..97b3301 100644 --- a/dictation_client/src/pages/UserListPage/popup.tsx +++ b/dictation_client/src/pages/UserListPage/popup.tsx @@ -10,7 +10,6 @@ import { changeRole, changeAuthorId, changeAutoRenew, - changeLicenseAlert, changeNotification, cleanupAddUser, addUserAsync, @@ -324,22 +323,6 @@ export const UserAddPopup: React.FC = (props) => { {t(getTranslationID("userListPage.label.autoRenew"))}

    -

    - -

    -

    - -

    The verification URL.

    `, - }, - }; + return { sendMail: undefined }; }; export const makeDefaultLicensesRepositoryMockValue = (): LicensesRepositoryMockValue => { diff --git a/dictation_server/src/features/accounts/types/types.ts b/dictation_server/src/features/accounts/types/types.ts index 64dff22..e0202f7 100644 --- a/dictation_server/src/features/accounts/types/types.ts +++ b/dictation_server/src/features/accounts/types/types.ts @@ -483,7 +483,6 @@ export class UpdateTypistGroupResponse {} export class CreatePartnerAccountResponse {} - export class PartnerLicenseInfo { @ApiProperty({ description: 'アカウントID' }) accountId: number; @@ -523,7 +522,6 @@ export class GetPartnerLicensesResponse { childrenPartnerLicenses: PartnerLicenseInfo[]; } - export class LicenseOrder { @ApiProperty({ description: '注文日付' }) orderDate: string; @@ -546,7 +544,6 @@ export class GetOrderHistoriesResponse { export class IssueLicenseResponse {} - export class Dealer { @ApiProperty({ description: 'アカウントID' }) id: number; @@ -563,7 +560,6 @@ export class GetDealersResponse { export class CancelIssueResponse {} - export class Worktype { @ApiProperty({ description: 'WorktypeのID' }) id: number; @@ -588,7 +584,6 @@ export class CreateWorktypeResponse {} export class UpdateWorktypeResponse {} - export class GetWorktypeOptionItem extends PostWorktypeOptionItem { @ApiProperty() id: number; @@ -609,7 +604,6 @@ export class DeleteWorktypeResponse {} export class PostActiveWorktypeResponse {} - export class Partner { @ApiProperty({ description: '会社名' }) name: string; @@ -678,4 +672,4 @@ export type PartnerInfoFromDb = { country: string; primaryAccountExternalId: string; dealerManagement: boolean; -}; \ No newline at end of file +}; diff --git a/dictation_server/src/features/files/test/files.service.mock.ts b/dictation_server/src/features/files/test/files.service.mock.ts index c69e7bf..8e9ca51 100644 --- a/dictation_server/src/features/files/test/files.service.mock.ts +++ b/dictation_server/src/features/files/test/files.service.mock.ts @@ -148,7 +148,6 @@ export const makeDefaultUsersRepositoryMockValue = updated_by: null, updated_at: new Date(), auto_renew: true, - license_alert: true, notification: true, encryption: false, prompt: false, diff --git a/dictation_server/src/features/licenses/test/liscense.service.mock.ts b/dictation_server/src/features/licenses/test/liscense.service.mock.ts index 5c0ef7b..be69679 100644 --- a/dictation_server/src/features/licenses/test/liscense.service.mock.ts +++ b/dictation_server/src/features/licenses/test/liscense.service.mock.ts @@ -120,7 +120,6 @@ export const makeDefaultUsersRepositoryMockValue = user1.accepted_dpa_version = '1.0'; user1.email_verified = true; user1.auto_renew = false; - user1.license_alert = false; user1.notification = false; user1.encryption = false; user1.prompt = false; diff --git a/dictation_server/src/features/notification/test/notification.service.mock.ts b/dictation_server/src/features/notification/test/notification.service.mock.ts index 51d7601..b11c985 100644 --- a/dictation_server/src/features/notification/test/notification.service.mock.ts +++ b/dictation_server/src/features/notification/test/notification.service.mock.ts @@ -82,7 +82,6 @@ export const makeDefaultUsersRepositoryMockValue = user.accepted_dpa_version = '1.0'; user.email_verified = true; user.auto_renew = false; - user.license_alert = false; user.notification = false; user.deleted_at = null; user.created_by = 'test'; diff --git a/dictation_server/src/features/tasks/test/tasks.service.mock.ts b/dictation_server/src/features/tasks/test/tasks.service.mock.ts index 94d3e7d..70dc66a 100644 --- a/dictation_server/src/features/tasks/test/tasks.service.mock.ts +++ b/dictation_server/src/features/tasks/test/tasks.service.mock.ts @@ -338,7 +338,6 @@ export const makeDefaultUsersRepositoryMockValue = user1.role = 'admin'; user1.email_verified = true; user1.auto_renew = false; - user1.license_alert = false; user1.notification = false; user1.deleted_at = null; user1.created_by = 'test'; @@ -482,7 +481,6 @@ const defaultTasksRepositoryMockValue: { accepted_dpa_version: '', email_verified: true, auto_renew: true, - license_alert: true, notification: true, encryption: false, prompt: false, diff --git a/dictation_server/src/features/users/test/users.service.mock.ts b/dictation_server/src/features/users/test/users.service.mock.ts index 6ca0723..0984d0f 100644 --- a/dictation_server/src/features/users/test/users.service.mock.ts +++ b/dictation_server/src/features/users/test/users.service.mock.ts @@ -48,11 +48,7 @@ export type AdB2cMockValue = { }; export type SendGridMockValue = { - createMailContentFromEmailConfirmForNormalUser: - | { subject: string; text: string; html: string } - | Error; sendMail: undefined | Error; - sendMailWithU113: undefined | Error; }; export type ConfigMockValue = { @@ -246,21 +242,13 @@ export const makeLicensesRepositoryMock = (): LicensesRepositoryMockValue => { }; export const makeSendGridMock = (value: SendGridMockValue) => { - const { sendMail, createMailContentFromEmailConfirmForNormalUser } = value; + const { sendMail } = value; return { sendMail: sendMail instanceof Error ? jest.fn, []>().mockRejectedValue(sendMail) : jest.fn, []>().mockResolvedValue(sendMail), - createMailContentFromEmailConfirmForNormalUser: - createMailContentFromEmailConfirmForNormalUser instanceof Error - ? jest - .fn, []>() - .mockRejectedValue(createMailContentFromEmailConfirmForNormalUser) - : jest - .fn, []>() - .mockResolvedValue(createMailContentFromEmailConfirmForNormalUser), }; }; @@ -276,15 +264,7 @@ export const makeConfigMock = (value: ConfigMockValue) => { }; export const makeDefaultSendGridlValue = (): SendGridMockValue => { - return { - sendMail: undefined, - createMailContentFromEmailConfirmForNormalUser: { - subject: 'test', - text: 'test', - html: 'test', - }, - sendMailWithU113: undefined, - }; + return { sendMail: undefined }; }; export const makeDefaultConfigValue = (): ConfigMockValue => { @@ -351,7 +331,6 @@ export const makeDefaultUsersRepositoryMockValue = user1.accepted_dpa_version = '1.0'; user1.email_verified = true; user1.auto_renew = false; - user1.license_alert = false; user1.notification = false; user1.encryption = false; user1.prompt = false; @@ -371,7 +350,6 @@ export const makeDefaultUsersRepositoryMockValue = user2.accepted_dpa_version = '1.0'; user2.email_verified = true; user2.auto_renew = false; - user2.license_alert = false; user2.notification = false; user2.encryption = false; user2.prompt = false; diff --git a/dictation_server/src/features/users/types/types.ts b/dictation_server/src/features/users/types/types.ts index 4478c13..80b1a13 100644 --- a/dictation_server/src/features/users/types/types.ts +++ b/dictation_server/src/features/users/types/types.ts @@ -1,5 +1,12 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsBoolean, IsEmail, IsIn, IsInt, IsOptional, MaxLength } from 'class-validator'; +import { + IsBoolean, + IsEmail, + IsIn, + IsInt, + IsOptional, + MaxLength, +} from 'class-validator'; import { TASK_LIST_SORTABLE_ATTRIBUTES, USER_LICENSE_STATUS, @@ -44,9 +51,6 @@ export class User { @ApiProperty() autoRenew: boolean; - @ApiProperty() - licenseAlert: boolean; - @ApiProperty() notification: boolean; @@ -97,11 +101,6 @@ export class SignupRequest { @IsBoolean() autoRenew: boolean; - @ApiProperty() - @Type(() => Boolean) - @IsBoolean() - licenseAlert: boolean; - @ApiProperty() @Type(() => Boolean) @IsBoolean() @@ -233,11 +232,6 @@ export class PostUpdateUserRequest { @IsBoolean() autoRenew: boolean; - @ApiProperty() - @Type(() => Boolean) - @IsBoolean() - licenseAlart: boolean; - @ApiProperty() @Type(() => Boolean) @IsBoolean() diff --git a/dictation_server/src/features/users/users.controller.ts b/dictation_server/src/features/users/users.controller.ts index 036e609..d607e50 100644 --- a/dictation_server/src/features/users/users.controller.ts +++ b/dictation_server/src/features/users/users.controller.ts @@ -249,7 +249,6 @@ export class UsersController { role, email, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -301,7 +300,6 @@ export class UsersController { role as UserRoles, email, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -569,7 +567,6 @@ export class UsersController { role, authorId, autoRenew, - licenseAlart, notification, encryption, encryptionPassword, @@ -619,7 +616,6 @@ export class UsersController { role, authorId, autoRenew, - licenseAlart, notification, encryption, encryptionPassword, diff --git a/dictation_server/src/features/users/users.service.spec.ts b/dictation_server/src/features/users/users.service.spec.ts index 115d77c..82a8199 100644 --- a/dictation_server/src/features/users/users.service.spec.ts +++ b/dictation_server/src/features/users/users.service.spec.ts @@ -221,7 +221,6 @@ describe('UsersService.confirmUserAndInitPassword', () => { updated_by: 'string;', updated_at: new Date(), auto_renew: true, - license_alert: true, notification: true, encryption: false, prompt: false, @@ -273,7 +272,6 @@ describe('UsersService.confirmUserAndInitPassword', () => { updated_by: 'string;', updated_at: new Date(), auto_renew: true, - license_alert: true, notification: true, encryption: false, prompt: false, @@ -324,7 +322,6 @@ describe('UsersService.confirmUserAndInitPassword', () => { updated_by: 'string;', updated_at: new Date(), auto_renew: true, - license_alert: true, notification: true, encryption: false, prompt: false, @@ -380,7 +377,6 @@ describe('UsersService.confirmUserAndInitPassword', () => { updated_by: 'string;', updated_at: new Date(), auto_renew: true, - license_alert: true, notification: true, encryption: false, prompt: false, @@ -484,14 +480,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); expect( await service.createUser( @@ -501,7 +490,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ), ).toEqual(undefined); @@ -514,7 +502,6 @@ describe('UsersService.createUser', () => { expect(user?.author_id).toEqual(null); expect(user?.email_verified).toEqual(false); expect(user?.auto_renew).toEqual(autoRenew); - expect(user?.license_alert).toEqual(licenseAlert); expect(user?.notification).toEqual(notification); expect(user?.encryption).toEqual(false); expect(user?.encryption_password).toEqual(null); @@ -571,14 +558,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); expect( await service.createUser( @@ -588,7 +568,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -605,7 +584,6 @@ describe('UsersService.createUser', () => { expect(user?.author_id).toEqual(authorId); expect(user?.email_verified).toEqual(false); expect(user?.auto_renew).toEqual(autoRenew); - expect(user?.license_alert).toEqual(licenseAlert); expect(user?.notification).toEqual(notification); expect(user?.encryption).toEqual(encryption); expect(user?.encryption_password).toEqual(encryptionPassword); @@ -661,14 +639,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); expect( await service.createUser( @@ -678,7 +649,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -695,7 +665,6 @@ describe('UsersService.createUser', () => { expect(user?.author_id).toEqual(authorId); expect(user?.email_verified).toEqual(false); expect(user?.auto_renew).toEqual(autoRenew); - expect(user?.license_alert).toEqual(licenseAlert); expect(user?.notification).toEqual(notification); expect(user?.encryption).toEqual(encryption); expect(user?.encryption_password).toBeNull(); @@ -748,14 +717,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); expect( await service.createUser( @@ -765,7 +727,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ), ).toEqual(undefined); @@ -778,7 +739,6 @@ describe('UsersService.createUser', () => { expect(user?.author_id).toBeNull(); expect(user?.email_verified).toEqual(false); expect(user?.auto_renew).toEqual(autoRenew); - expect(user?.license_alert).toEqual(licenseAlert); expect(user?.notification).toEqual(notification); expect(user?.encryption).toEqual(false); expect(user?.encryption_password).toBeNull(); @@ -828,14 +788,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); // DBエラーを発生させる overrideUsersRepositoryService(service, { @@ -852,7 +805,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ); } catch (e) { @@ -914,14 +866,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); // DBエラーを発生させる overrideUsersRepositoryService(service, { @@ -938,7 +883,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ); } catch (e) { @@ -990,14 +934,7 @@ describe('UsersService.createUser', () => { throw new Error('ADB2C error'); }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); try { await service.createUser( @@ -1007,7 +944,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ); } catch (e) { @@ -1057,14 +993,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); try { await service.createUser( @@ -1074,7 +1003,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ); } catch (e) { @@ -1132,14 +1060,7 @@ describe('UsersService.createUser', () => { }; }, }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); expect( await service.createUser( @@ -1149,7 +1070,6 @@ describe('UsersService.createUser', () => { role, email_1, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -1190,7 +1110,6 @@ describe('UsersService.createUser', () => { role, email_2, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -1255,14 +1174,7 @@ describe('UsersService.createUser', () => { }, deleteUser: jest.fn(), }); - overrideSendgridService(service, { - sendMail: async () => { - return; - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); // AuthorIDのUNIQUE制約エラーを発生させる overrideUsersRepositoryService(service, { @@ -1279,7 +1191,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -1344,14 +1255,7 @@ describe('UsersService.createUser', () => { }, deleteUser: jest.fn(), }); - overrideSendgridService(service, { - sendMail: async () => { - throw new Error(); - }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, - }); + overrideSendgridService(service, {}); try { await service.createUser( @@ -1361,7 +1265,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ); } catch (e) { @@ -1423,9 +1326,6 @@ describe('UsersService.createUser', () => { sendMail: async () => { throw new Error(); }, - createMailContentFromEmailConfirmForNormalUser: async () => { - return { html: '', text: '', subject: '' }; - }, }); overrideUsersRepositoryService(service, { deleteNormalUser: async () => { @@ -1441,7 +1341,6 @@ describe('UsersService.createUser', () => { role, email, autoRenew, - licenseAlert, notification, ); } catch (e) { @@ -1538,7 +1437,6 @@ describe('UsersService.getUsers', () => { email: 'test1@mail.com', emailVerified: true, autoRenew: true, - licenseAlert: true, notification: true, encryption: false, prompt: false, @@ -1555,7 +1453,6 @@ describe('UsersService.getUsers', () => { email: 'test2@mail.com', emailVerified: true, autoRenew: true, - licenseAlert: true, notification: true, encryption: false, prompt: false, @@ -1572,7 +1469,6 @@ describe('UsersService.getUsers', () => { email: 'test3@mail.com', emailVerified: true, autoRenew: true, - licenseAlert: true, notification: true, encryption: false, prompt: false, @@ -1651,7 +1547,6 @@ describe('UsersService.getUsers', () => { email: 'test1@mail.com', emailVerified: true, autoRenew: true, - licenseAlert: true, notification: true, encryption: false, prompt: false, @@ -1670,7 +1565,6 @@ describe('UsersService.getUsers', () => { email: 'test2@mail.com', emailVerified: true, autoRenew: true, - licenseAlert: true, notification: true, encryption: false, prompt: false, @@ -1689,7 +1583,6 @@ describe('UsersService.getUsers', () => { email: 'test3@mail.com', emailVerified: true, autoRenew: false, - licenseAlert: true, notification: true, encryption: false, prompt: false, @@ -2007,7 +1900,6 @@ describe('UsersService.updateUser', () => { undefined, false, false, - false, undefined, undefined, undefined, @@ -2020,7 +1912,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.NONE); expect(createdUser?.author_id).toBeNull(); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(false); expect(createdUser?.encryption_password).toBeNull(); @@ -2067,7 +1958,6 @@ describe('UsersService.updateUser', () => { undefined, false, false, - false, undefined, undefined, undefined, @@ -2080,7 +1970,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.TYPIST); expect(createdUser?.author_id).toBeNull(); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(false); expect(createdUser?.encryption_password).toBeNull(); @@ -2127,7 +2016,6 @@ describe('UsersService.updateUser', () => { 'AUTHOR_ID', false, false, - false, true, 'new_password', true, @@ -2140,7 +2028,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.AUTHOR); expect(createdUser?.author_id).toBe('AUTHOR_ID'); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(true); expect(createdUser?.encryption_password).toBe('new_password'); @@ -2187,7 +2074,6 @@ describe('UsersService.updateUser', () => { undefined, false, false, - false, undefined, undefined, undefined, @@ -2200,7 +2086,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.TYPIST); expect(createdUser?.author_id).toBeNull(); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(false); expect(createdUser?.encryption_password).toBeNull(); @@ -2248,7 +2133,6 @@ describe('UsersService.updateUser', () => { false, false, false, - false, undefined, false, ), @@ -2260,7 +2144,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.AUTHOR); expect(createdUser?.author_id).toBe('AUTHOR_ID'); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(false); expect(createdUser?.encryption_password).toBeNull(); @@ -2307,7 +2190,6 @@ describe('UsersService.updateUser', () => { undefined, false, false, - false, undefined, undefined, undefined, @@ -2357,7 +2239,6 @@ describe('UsersService.updateUser', () => { 'AUTHOR_ID', false, false, - false, true, undefined, true, @@ -2370,7 +2251,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.AUTHOR); expect(createdUser?.author_id).toBe('AUTHOR_ID'); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(true); expect(createdUser?.encryption_password).toBe('password'); @@ -2418,7 +2298,6 @@ describe('UsersService.updateUser', () => { false, false, false, - false, 'password', true, ), @@ -2430,7 +2309,6 @@ describe('UsersService.updateUser', () => { expect(createdUser?.role).toBe(USER_ROLES.AUTHOR); expect(createdUser?.author_id).toBe('AUTHOR_ID'); expect(createdUser?.auto_renew).toBe(false); - expect(createdUser?.license_alert).toBe(false); expect(createdUser?.notification).toBe(false); expect(createdUser?.encryption).toBe(false); expect(createdUser?.encryption_password).toBeNull(); @@ -2477,7 +2355,6 @@ describe('UsersService.updateUser', () => { 'AUTHOR_ID', false, false, - false, true, undefined, true, @@ -2538,7 +2415,6 @@ describe('UsersService.updateUser', () => { 'AUTHOR_ID2', false, false, - false, true, undefined, true, diff --git a/dictation_server/src/features/users/users.service.ts b/dictation_server/src/features/users/users.service.ts index 84e54fc..e48e24f 100644 --- a/dictation_server/src/features/users/users.service.ts +++ b/dictation_server/src/features/users/users.service.ts @@ -148,18 +148,18 @@ export class UsersService { /** * Creates user - * @param accessToken + * @param context + * @param externalId * @param name * @param role * @param email * @param autoRenew - * @param licenseAlert * @param notification * @param [authorId] * @param [encryption] * @param [encryptionPassword] * @param [prompt] - * @returns void + * @returns user */ async createUser( context: Context, @@ -168,7 +168,6 @@ export class UsersService { role: UserRoles, email: string, autoRenew: boolean, - licenseAlert: boolean, notification: boolean, authorId?: string | undefined, encryption?: boolean | undefined, @@ -180,7 +179,6 @@ export class UsersService { `externalId: ${externalId}, ` + `role: ${role}, ` + `autoRenew: ${autoRenew}, ` + - `licenseAlert: ${licenseAlert}, ` + `notification: ${notification}, ` + `authorId: ${authorId}, ` + `encryption: ${encryption}, ` + @@ -272,7 +270,6 @@ export class UsersService { accountId, externalUser.sub, autoRenew, - licenseAlert, notification, authorId, encryption, @@ -408,7 +405,6 @@ export class UsersService { accountId: number, externalId: string, autoRenew: boolean, - licenseAlert: boolean, notification: boolean, authorId?: string | undefined, encryption?: boolean | undefined, @@ -424,7 +420,6 @@ export class UsersService { `authorId: ${authorId}, ` + `externalId: ${externalId}, ` + `autoRenew: ${autoRenew}, ` + - `licenseAlert: ${licenseAlert}, ` + `notification: ${notification}, ` + `authorId: ${authorId}, ` + `encryption: ${encryption}, ` + @@ -438,7 +433,6 @@ export class UsersService { account_id: accountId, external_id: externalId, auto_renew: autoRenew, - license_alert: licenseAlert, notification, role, accepted_dpa_version: null, @@ -454,7 +448,6 @@ export class UsersService { account_id: accountId, external_id: externalId, auto_renew: autoRenew, - license_alert: licenseAlert, notification, role, author_id: authorId ?? null, @@ -671,7 +664,6 @@ export class UsersService { email: mail, emailVerified: dbUser.email_verified, autoRenew: dbUser.auto_renew, - licenseAlert: dbUser.license_alert, notification: dbUser.notification, encryption: dbUser.encryption, prompt: dbUser.prompt, @@ -901,14 +893,13 @@ export class UsersService { } /** - * 指定したユーザーの情報を更新します + * Updates user * @param context * @param extarnalId * @param id * @param role * @param authorId * @param autoRenew - * @param licenseAlart * @param notification * @param encryption * @param encryptionPassword @@ -922,7 +913,6 @@ export class UsersService { role: string, authorId: string | undefined, autoRenew: boolean, - licenseAlart: boolean, notification: boolean, encryption: boolean | undefined, encryptionPassword: string | undefined, @@ -938,7 +928,6 @@ export class UsersService { `role: ${role}, ` + `authorId: ${authorId}, ` + `autoRenew: ${autoRenew}, ` + - `licenseAlart: ${licenseAlart}, ` + `notification: ${notification}, ` + `encryption: ${encryption}, ` + `prompt: ${prompt} }`, @@ -957,7 +946,6 @@ export class UsersService { role, authorId, autoRenew, - licenseAlart, notification, encryption, encryptionPassword, diff --git a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts index ab0ca1f..6e2fb15 100644 --- a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts +++ b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts @@ -28,8 +28,6 @@ export class SendGridService { private readonly emailConfirmLifetime: number; private readonly appDomain: string; private readonly mailFrom: string; - private readonly templateEmailVerifyHtml: string; - private readonly templateEmailVerifyText: string; private readonly templateU101Html: string; private readonly templateU101Text: string; private readonly templateU102Html: string; @@ -71,15 +69,6 @@ export class SendGridService { // メールテンプレートを読み込む { - this.templateEmailVerifyHtml = readFileSync( - path.resolve(__dirname, `../../templates/template_email_verify.html`), - 'utf-8', - ); - this.templateEmailVerifyText = readFileSync( - path.resolve(__dirname, `../../templates/template_email_verify.txt`), - 'utf-8', - ); - this.templateU101Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_101.html`), 'utf-8', @@ -96,7 +85,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_102.txt`), 'utf-8', ); - this.templateU105Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_105.html`), 'utf-8', @@ -105,7 +93,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_105.txt`), 'utf-8', ); - this.templateU106Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_106.html`), 'utf-8', @@ -114,7 +101,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_106.txt`), 'utf-8', ); - this.templateU107Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_107.html`), 'utf-8', @@ -123,7 +109,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_107.txt`), 'utf-8', ); - this.templateU108Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_108.html`), 'utf-8', @@ -132,7 +117,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_108.txt`), 'utf-8', ); - this.templateU109Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_109.html`), 'utf-8', @@ -149,7 +133,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_111.txt`), 'utf-8', ); - this.templateU112Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_112.html`), 'utf-8', @@ -193,7 +176,6 @@ export class SendGridService { path.resolve(__dirname, `../../templates/template_U_115.txt`), 'utf-8', ); - this.templateU117Html = readFileSync( path.resolve(__dirname, `../../templates/template_U_117.html`), 'utf-8', @@ -205,47 +187,6 @@ export class SendGridService { } } - /** - * Email認証用のメールコンテンツを作成する(一般ユーザ向け) - * @param accountId 認証対象のユーザーが所属するアカウントのID - * @param userId 認証対象のユーザーのID - * @param email 認証対象のユーザーのメールアドレス - * @returns メールのサブジェクトとコンテンツ - */ - //TODO [Task2163] 中身が管理ユーザ向けのままなので、修正の必要あり - async createMailContentFromEmailConfirmForNormalUser( - context: Context, - accountId: number, - userId: number, - email: string, - ): Promise<{ subject: string; text: string; html: string }> { - this.logger.log( - `[IN] [${context.getTrackingId()}] ${ - this.createMailContentFromEmailConfirmForNormalUser.name - } | params: { ` + - `accountId: ${accountId},` + - `userId: ${userId} };`, - ); - const privateKey = getPrivateKey(this.configService); - - const token = sign<{ accountId: number; userId: number; email: string }>( - { - accountId, - userId, - email, - }, - this.emailConfirmLifetime, - privateKey, - ); - const path = 'mail-confirm/user/'; - - return { - subject: 'Verify your new account', - text: `The verification URL. ${this.appDomain}${path}?verify=${token}`, - html: `

    The verification URL.

    ${this.appDomain}${path}?verify=${token}`, - }; - } - /** * U-101のテンプレートを使用したメールを送信する * @param context @@ -376,7 +317,7 @@ export class SendGridService { .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); // メールを送信する - this.sendMail( + await this.sendMail( context, customerMails, dealerEmails, @@ -431,7 +372,7 @@ export class SendGridService { .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); // メールを送信する - this.sendMail( + await this.sendMail( context, customerMails, dealerEmails, @@ -486,7 +427,7 @@ export class SendGridService { .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); // メールを送信する - this.sendMail( + await this.sendMail( context, customerMails, dealerEmails, @@ -502,61 +443,6 @@ export class SendGridService { } } - /** - * U-109のテンプレートを使用したメールを送信する - * @param context context - * @param dealerEmails ライセンス発行をキャンセルした上位アカウントの管理者(primary/secondary)のメールアドレス - * @param dealerAccountName ライセンス発行をキャンセルした上位アカウントの会社名 - * @param lisenceCount ライセンス発行をキャンセルした対象の注文の内容(ライセンス数) - * @param poNumber ライセンス発行をキャンセルした対象の注文の内容(PO番号) - * @param customerMails ライセンス発行をキャンセルされたアカウントの管理者(primary/secondary)のメールアドレス - * @param customerAccountName ライセンス発行をキャンセルされたアカウントの会社名 - * @returns - */ - async sendMailWithU109( - context: Context, - dealerEmails: string[], - dealerAccountName: string, - lisenceCount: number, - poNumber: string, - customerMails: string[], - customerAccountName: string, - ): Promise { - this.logger.log( - `[IN] [${context.getTrackingId()}] ${this.sendMailWithU109.name}`, - ); - try { - const subject = 'License Returned Notification [U-109]'; - - // メールの本文を作成する - const html = this.templateU109Html - .replaceAll(CUSTOMER_NAME, customerAccountName) - .replaceAll(DEALER_NAME, dealerAccountName) - .replaceAll(PO_NUMBER, poNumber) - .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); - const text = this.templateU109Text - .replaceAll(CUSTOMER_NAME, customerAccountName) - .replaceAll(DEALER_NAME, dealerAccountName) - .replaceAll(PO_NUMBER, poNumber) - .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); - - // メールを送信する - this.sendMail( - context, - dealerEmails, - customerMails, - this.mailFrom, - subject, - text, - html, - ); - } finally { - this.logger.log( - `[OUT] [${context.getTrackingId()}] ${this.sendMailWithU109.name}`, - ); - } - } - /** * U-108のテンプレートを使用したメールを送信する * @param context @@ -598,7 +484,7 @@ export class SendGridService { const ccAddress = customerAdminMails.includes(userMail) ? [] : [userMail]; // メールを送信する - this.sendMail( + await this.sendMail( context, customerAdminMails, ccAddress, @@ -614,6 +500,61 @@ export class SendGridService { } } + /** + * U-109のテンプレートを使用したメールを送信する + * @param context context + * @param dealerEmails ライセンス発行をキャンセルした上位アカウントの管理者(primary/secondary)のメールアドレス + * @param dealerAccountName ライセンス発行をキャンセルした上位アカウントの会社名 + * @param lisenceCount ライセンス発行をキャンセルした対象の注文の内容(ライセンス数) + * @param poNumber ライセンス発行をキャンセルした対象の注文の内容(PO番号) + * @param customerMails ライセンス発行をキャンセルされたアカウントの管理者(primary/secondary)のメールアドレス + * @param customerAccountName ライセンス発行をキャンセルされたアカウントの会社名 + * @returns + */ + async sendMailWithU109( + context: Context, + dealerEmails: string[], + dealerAccountName: string, + lisenceCount: number, + poNumber: string, + customerMails: string[], + customerAccountName: string, + ): Promise { + this.logger.log( + `[IN] [${context.getTrackingId()}] ${this.sendMailWithU109.name}`, + ); + try { + const subject = 'License Returned Notification [U-109]'; + + // メールの本文を作成する + const html = this.templateU109Html + .replaceAll(CUSTOMER_NAME, customerAccountName) + .replaceAll(DEALER_NAME, dealerAccountName) + .replaceAll(PO_NUMBER, poNumber) + .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); + const text = this.templateU109Text + .replaceAll(CUSTOMER_NAME, customerAccountName) + .replaceAll(DEALER_NAME, dealerAccountName) + .replaceAll(PO_NUMBER, poNumber) + .replaceAll(LICENSE_QUANTITY, `${lisenceCount}`); + + // メールを送信する + await this.sendMail( + context, + dealerEmails, + customerMails, + this.mailFrom, + subject, + text, + html, + ); + } finally { + this.logger.log( + `[OUT] [${context.getTrackingId()}] ${this.sendMailWithU109.name}`, + ); + } + } + /** * U-111のテンプレートを使用したメールを送信する * @param context @@ -646,7 +587,7 @@ export class SendGridService { .replaceAll(TOP_URL, this.appDomain); // メールを送信する - this.sendMail( + await this.sendMail( context, [primaryAdminMail], [], @@ -712,7 +653,7 @@ export class SendGridService { } // メールを送信する - this.sendMail( + await this.sendMail( context, [primaryAdminMail], [], @@ -757,7 +698,7 @@ export class SendGridService { .replaceAll(TEMPORARY_PASSWORD, temporaryPassword); // メールを送信する - this.sendMail( + await this.sendMail( context, [userMail], [], @@ -818,7 +759,7 @@ export class SendGridService { .replaceAll(VERIFY_LINK, verifyLink); // メールを送信する - this.sendMail( + await this.sendMail( context, [userMail], [], @@ -868,7 +809,7 @@ export class SendGridService { const ccAdminMails = adminMails.filter((x) => x !== userMail); // メールを送信する - this.sendMail( + await this.sendMail( context, [userMail], ccAdminMails, @@ -923,7 +864,7 @@ export class SendGridService { .replaceAll(PRIMARY_ADMIN_NAME, adminName); // メールを送信する - this.sendMail( + await this.sendMail( context, [authorEmail, typistEmail], [], diff --git a/dictation_server/src/repositories/accounts/accounts.repository.service.ts b/dictation_server/src/repositories/accounts/accounts.repository.service.ts index 2d0d78c..6d7c758 100644 --- a/dictation_server/src/repositories/accounts/accounts.repository.service.ts +++ b/dictation_server/src/repositories/accounts/accounts.repository.service.ts @@ -59,7 +59,11 @@ import { deleteEntity, } from '../../common/repository'; import { Context } from '../../common/log'; -import { LicenseSummaryInfo, PartnerInfoFromDb, PartnerLicenseInfoForRepository } from '../../features/accounts/types/types'; +import { + LicenseSummaryInfo, + PartnerInfoFromDb, + PartnerLicenseInfoForRepository, +} from '../../features/accounts/types/types'; @Injectable() export class AccountsRepositoryService { diff --git a/dictation_server/src/repositories/users/entity/user.entity.ts b/dictation_server/src/repositories/users/entity/user.entity.ts index 0f4e57c..0666afb 100644 --- a/dictation_server/src/repositories/users/entity/user.entity.ts +++ b/dictation_server/src/repositories/users/entity/user.entity.ts @@ -46,9 +46,6 @@ export class User { @Column({ default: true }) auto_renew: boolean; - @Column({ default: true }) - license_alert: boolean; - @Column({ default: true }) notification: boolean; @@ -127,9 +124,6 @@ export class UserArchive { @Column() auto_renew: boolean; - @Column() - license_alert: boolean; - @Column() notification: boolean; diff --git a/dictation_server/src/repositories/users/users.repository.service.ts b/dictation_server/src/repositories/users/users.repository.service.ts index 2fb67af..9237bdd 100644 --- a/dictation_server/src/repositories/users/users.repository.service.ts +++ b/dictation_server/src/repositories/users/users.repository.service.ts @@ -67,7 +67,6 @@ export class UsersRepositoryService { external_id: externalUserId, role, auto_renew, - license_alert, notification, author_id, accepted_eula_version, @@ -82,7 +81,6 @@ export class UsersRepositoryService { userEntity.account_id = accountId; userEntity.external_id = externalUserId; userEntity.auto_renew = auto_renew; - userEntity.license_alert = license_alert; userEntity.notification = notification; userEntity.author_id = author_id; userEntity.accepted_eula_version = accepted_eula_version; @@ -278,7 +276,6 @@ export class UsersRepositoryService { role: string, authorId: string | undefined, autoRenew: boolean, - licenseAlart: boolean, notification: boolean, encryption: boolean | undefined, encryptionPassword: string | undefined, @@ -345,7 +342,6 @@ export class UsersRepositoryService { // 共通項目を更新 targetUser.role = role; targetUser.auto_renew = autoRenew; - targetUser.license_alert = licenseAlart; targetUser.notification = notification; const result = await updateEntity( diff --git a/dictation_server/src/templates/template_U_113.html b/dictation_server/src/templates/template_U_113.html index 4745d21..708545f 100644 --- a/dictation_server/src/templates/template_U_113.html +++ b/dictation_server/src/templates/template_U_113.html @@ -12,7 +12,7 @@ password for security reasons. To change your password, click on [Forgot your password?] link on the ODMS Cloud Sign in screen.

    -

    Temporary password:$TEMPORARY_PASSWORD$

    +

    Temporary password: $TEMPORARY_PASSWORD$

    If you need support regarding ODMS Cloud, please contact $PRIMARY_ADMIN_NAME$. @@ -34,7 +34,7 @@ Passwort zu ändern, klicken Sie auf dem ODMS Cloud-Anmeldebildschirm auf den Link [Kennwort vergessen?].

    -

    Temporäres Passwort:$TEMPORARY_PASSWORD$

    +

    Temporäres Passwort: $TEMPORARY_PASSWORD$

    Wenn Sie Unterstützung bezüglich ODMS Cloud benötigen, wenden Sie sich bitte an $PRIMARY_ADMIN_NAME$. @@ -57,7 +57,7 @@ lien [Vous avez oublié votre mot de passe ?] sur l'écran de connexion ODMS Cloud.

    -

    Temporary password:$TEMPORARY_PASSWORD$

    +

    Temporary password: $TEMPORARY_PASSWORD$

    Si vous avez besoin d'assistance concernant ODMS Cloud, veuillez contacter $PRIMARY_ADMIN_NAME$. diff --git a/dictation_server/src/templates/template_U_113.txt b/dictation_server/src/templates/template_U_113.txt index 5c444c6..f84bd50 100644 --- a/dictation_server/src/templates/template_U_113.txt +++ b/dictation_server/src/templates/template_U_113.txt @@ -2,7 +2,7 @@ Your user registration has been completed. Please login to ODMS Cloud with the following temporary password. You may continue using your temporary password; however, we strongly recommend that you change your password for security reasons. To change your password, click on [Forgot your password?] link on the ODMS Cloud Sign in screen. -Temporary password:$TEMPORARY_PASSWORD$ +Temporary password: $TEMPORARY_PASSWORD$ If you need support regarding ODMS Cloud, please contact $PRIMARY_ADMIN_NAME$. @@ -13,7 +13,7 @@ This is an automatically generated e-mail and this mailbox is not monitored. P Ihre Benutzerregistrierung ist abgeschlossen. Bitte melden Sie sich mit dem folgenden temporären Passwort bei ODMS Cloud an. Sie können Ihr temporäres Passwort weiterhin verwenden; Aus Sicherheitsgründen empfehlen wir Ihnen jedoch dringend, Ihr Passwort zu ändern. Um Ihr Passwort zu ändern, klicken Sie auf dem ODMS Cloud-Anmeldebildschirm auf den Link [Kennwort vergessen?]. -Temporäres Passwort:$TEMPORARY_PASSWORD$ +Temporäres Passwort: $TEMPORARY_PASSWORD$ Wenn Sie Unterstützung bezüglich ODMS Cloud benötigen, wenden Sie sich bitte an $PRIMARY_ADMIN_NAME$. @@ -24,7 +24,7 @@ Dies ist eine automatisch generierte E-Mail und dieses Postfach wird nicht über Votre inscription d'utilisateur est terminée. Veuillez vous connecter à ODMS Cloud avec le mot de passe temporaire suivant. Vous pouvez continuer à utiliser votre mot de passe temporaire ; cependant, nous vous recommandons fortement de changer votre mot de passe pour des raisons de sécurité. Pour modifier votre mot de passe, cliquez sur le lien [Vous avez oublié votre mot de passe ?] sur l'écran de connexion ODMS Cloud. -Temporary password:$TEMPORARY_PASSWORD$ +Temporary password: $TEMPORARY_PASSWORD$ Si vous avez besoin d'assistance concernant ODMS Cloud, veuillez contacter $PRIMARY_ADMIN_NAME$.