Merged PR 701: パイプラインエラー対応
## 概要 [Task3531: パイプラインエラー対応](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3531) - パイプラインエラー解消 ## レビューポイント - 共有
This commit is contained in:
parent
a7bb32ec4a
commit
1524ec2473
@ -27,9 +27,30 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
displayName: 'タグが付けられたCommitがmainブランチに存在するか確認'
|
displayName: 'タグが付けられたCommitがmainブランチに存在するか確認'
|
||||||
- job: backend_build
|
- job: backend_test
|
||||||
dependsOn: initialize
|
dependsOn: initialize
|
||||||
condition: succeeded('initialize')
|
condition: succeeded('initialize')
|
||||||
|
displayName: UnitTest
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
clean: true
|
||||||
|
fetchDepth: 1
|
||||||
|
- task: Bash@3
|
||||||
|
displayName: Bash Script (Test)
|
||||||
|
inputs:
|
||||||
|
targetType: inline
|
||||||
|
workingDirectory: dictation_server/.devcontainer
|
||||||
|
script: |
|
||||||
|
docker-compose -f pipeline-docker-compose.yml build
|
||||||
|
docker-compose -f pipeline-docker-compose.yml up -d
|
||||||
|
docker-compose exec -T dictation_server sudo npm ci
|
||||||
|
docker-compose exec -T dictation_server sudo npm run migrate:up:test
|
||||||
|
docker-compose exec -T dictation_server sudo npm run test
|
||||||
|
- job: backend_build
|
||||||
|
dependsOn: backend_test
|
||||||
|
condition: succeeded('backend_test')
|
||||||
displayName: Build And Push Backend Image
|
displayName: Build And Push Backend Image
|
||||||
pool:
|
pool:
|
||||||
name: odms-deploy-pipeline
|
name: odms-deploy-pipeline
|
||||||
@ -43,51 +64,6 @@ jobs:
|
|||||||
command: ci
|
command: ci
|
||||||
workingDir: dictation_server
|
workingDir: dictation_server
|
||||||
verbose: false
|
verbose: false
|
||||||
- task: AzureKeyVault@2
|
|
||||||
displayName: 'Azure Key Vault: kv-odms-secret-stg'
|
|
||||||
inputs:
|
|
||||||
ConnectedServiceName: 'omds-service-connection-stg'
|
|
||||||
KeyVaultName: kv-odms-secret-stg
|
|
||||||
SecretsFilter: '*'
|
|
||||||
- task: Bash@3
|
|
||||||
displayName: Bash Script (Test)
|
|
||||||
inputs:
|
|
||||||
targetType: inline
|
|
||||||
script: |
|
|
||||||
cd dictation_server
|
|
||||||
npm run test
|
|
||||||
env:
|
|
||||||
JWT_PUBLIC_KEY: $(token-public-key)
|
|
||||||
JWT_PRIVATE_KEY: $(token-private-key)
|
|
||||||
SENDGRID_API_KEY: $(sendgrid-api-key)
|
|
||||||
NOTIFICATION_HUB_NAME: $(notification-hub-name)
|
|
||||||
NOTIFICATION_HUB_CONNECT_STRING: $(notification-hub-connect-string)
|
|
||||||
STORAGE_ACCOUNT_NAME_US: $(storage-account-name-us)
|
|
||||||
STORAGE_ACCOUNT_NAME_AU: $(storage-account-name-au)
|
|
||||||
STORAGE_ACCOUNT_NAME_EU: $(storage-account-name-eu)
|
|
||||||
STORAGE_ACCOUNT_KEY_US: $(storage-account-key-us)
|
|
||||||
STORAGE_ACCOUNT_KEY_AU: $(storage-account-key-au)
|
|
||||||
STORAGE_ACCOUNT_KEY_EU: $(storage-account-key-eu)
|
|
||||||
STORAGE_ACCOUNT_ENDPOINT_US: $(storage-account-endpoint-us)
|
|
||||||
STORAGE_ACCOUNT_ENDPOINT_AU: $(storage-account-endpoint-au)
|
|
||||||
STORAGE_ACCOUNT_ENDPOINT_EU: $(storage-account-endpoint-eu)
|
|
||||||
ADB2C_TENANT_ID: $(adb2c-tenant-id)
|
|
||||||
ADB2C_CLIENT_ID: $(adb2c-client-id)
|
|
||||||
ADB2C_CLIENT_SECRET: $(adb2c-client-secret)
|
|
||||||
MAIL_FROM: xxxxxx
|
|
||||||
APP_DOMAIN: xxxxxxxxx
|
|
||||||
EMAIL_CONFIRM_LIFETIME: 0
|
|
||||||
TENANT_NAME: xxxxxxxxxxxx
|
|
||||||
SIGNIN_FLOW_NAME: xxxxxxxxxxxx
|
|
||||||
STORAGE_TOKEN_EXPIRE_TIME: 0
|
|
||||||
REFRESH_TOKEN_LIFETIME_WEB: 86400000
|
|
||||||
REFRESH_TOKEN_LIFETIME_DEFAULT: 2592000000
|
|
||||||
ACCESS_TOKEN_LIFETIME_WEB: 7200000
|
|
||||||
REDIS_HOST: xxxxxxxxxxxx
|
|
||||||
REDIS_PORT: 0
|
|
||||||
REDIS_PASSWORD: xxxxxxxxxxxx
|
|
||||||
ADB2C_CACHE_TTL: 0
|
|
||||||
STAGE: local
|
|
||||||
- task: Docker@0
|
- task: Docker@0
|
||||||
displayName: build
|
displayName: build
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
@ -102,6 +102,7 @@ const AccountPage: React.FC = (): JSX.Element => {
|
|||||||
|
|
||||||
<section className={styles.account}>
|
<section className={styles.account}>
|
||||||
<div className={styles.boxFlex}>
|
<div className={styles.boxFlex}>
|
||||||
|
{/* File Delete Setting は現状不要のため非表示
|
||||||
<ul className={`${styles.menuAction} ${styles.box100}`}>
|
<ul className={`${styles.menuAction} ${styles.box100}`}>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
@ -119,6 +120,7 @@ const AccountPage: React.FC = (): JSX.Element => {
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
*/}
|
||||||
|
|
||||||
<div className={styles.marginRgt3}>
|
<div className={styles.marginRgt3}>
|
||||||
<dl className={styles.listVertical}>
|
<dl className={styles.listVertical}>
|
||||||
|
|||||||
@ -67,9 +67,6 @@ const AuthPage: React.FC = (): JSX.Element => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const loginResult = await instance.handleRedirectPromise();
|
const loginResult = await instance.handleRedirectPromise();
|
||||||
|
|
||||||
// eslint-disable-next-line
|
|
||||||
console.log({ loginResult }); // TODO:loading画面から遷移できない事象の調査用ログ。事象解消後削除(eslint-disable含めて)する。
|
|
||||||
if (loginResult && loginResult.account) {
|
if (loginResult && loginResult.account) {
|
||||||
const { homeAccountId, idTokenClaims } = loginResult.account;
|
const { homeAccountId, idTokenClaims } = loginResult.account;
|
||||||
if (idTokenClaims && idTokenClaims.aud) {
|
if (idTokenClaims && idTokenClaims.aud) {
|
||||||
|
|||||||
@ -289,13 +289,17 @@ export const LicenseSummary: React.FC<LicenseSummaryProps> = (
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</dt>
|
</dt>
|
||||||
<dd>{licenseSummaryInfo.storageSize}GB</dd>
|
{/* Storage Usedの値表示をハイフンに置き換え */}
|
||||||
|
{/* <dd>{licenseSummaryInfo.storageSize}GB</dd> */}
|
||||||
|
<dd>-</dd>
|
||||||
<dt>
|
<dt>
|
||||||
{t(
|
{t(
|
||||||
getTranslationID("LicenseSummaryPage.label.usedSize")
|
getTranslationID("LicenseSummaryPage.label.usedSize")
|
||||||
)}
|
)}
|
||||||
</dt>
|
</dt>
|
||||||
<dd>{licenseSummaryInfo.usedSize}GB</dd>
|
{/* Storage Usedの値表示をハイフンに置き換え */}
|
||||||
|
{/* <dd>{licenseSummaryInfo.usedSize}GB</dd> */}
|
||||||
|
<dd>-</dd>
|
||||||
<dt className={styles.overLine}>
|
<dt className={styles.overLine}>
|
||||||
{t(
|
{t(
|
||||||
getTranslationID(
|
getTranslationID(
|
||||||
|
|||||||
@ -185,6 +185,7 @@ const PartnerPage: React.FC = (): JSX.Element => {
|
|||||||
<tr>
|
<tr>
|
||||||
<td className={styles.clm0}>
|
<td className={styles.clm0}>
|
||||||
<ul className={styles.menuInTable}>
|
<ul className={styles.menuInTable}>
|
||||||
|
{/* パートナーアカウント削除はCCB後回し分なので非表示
|
||||||
{isVisibleButton && (
|
{isVisibleButton && (
|
||||||
<li>
|
<li>
|
||||||
<a>
|
<a>
|
||||||
@ -196,6 +197,7 @@ const PartnerPage: React.FC = (): JSX.Element => {
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
|
*/}
|
||||||
{isVisibleDealerManagement && (
|
{isVisibleDealerManagement && (
|
||||||
<li>
|
<li>
|
||||||
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
||||||
|
|||||||
@ -39,7 +39,11 @@ const SignupInput: React.FC = (): JSX.Element => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [isPasswordHide, setIsPasswordHide] = useState<boolean>(true);
|
const [isPasswordHide, setIsPasswordHide] = useState<boolean>(true);
|
||||||
const [isOpenPolicy, setIsOpenPolicy] = useState<boolean>(false);
|
const [isOpenPolicy, setIsOpenPolicy] = useState<boolean>(false);
|
||||||
const [isAgreePolicy, setIsAgreePolicy] = useState<boolean>(false);
|
const [isOpenPrivacyNotice, setIsOpenPrivacyNoyice] =
|
||||||
|
useState<boolean>(false);
|
||||||
|
const [isCheckedEula, setIsCheckedEula] = useState<boolean>(false);
|
||||||
|
const [isCheckedPrivacyNotice, setIsCheckedPrivacyNotice] =
|
||||||
|
useState<boolean>(false);
|
||||||
const [isPushCreateButton, setIsPushCreateButton] = useState<boolean>(false);
|
const [isPushCreateButton, setIsPushCreateButton] = useState<boolean>(false);
|
||||||
const {
|
const {
|
||||||
hasErrorEmptyAdminName,
|
hasErrorEmptyAdminName,
|
||||||
@ -90,6 +94,9 @@ const SignupInput: React.FC = (): JSX.Element => {
|
|||||||
dispatch(getLatestEulaVersionAsync());
|
dispatch(getLatestEulaVersionAsync());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
|
// ボタン押下可否判定ロジック
|
||||||
|
const canClickButton = () => isCheckedEula && isCheckedPrivacyNotice;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 外部のWebサイトからの遷移時にURLのパラメータを取得
|
// 外部のWebサイトからの遷移時にURLのパラメータを取得
|
||||||
// 以下のようなURLで遷移してきた場合に、Dealerと言語を変更する
|
// 以下のようなURLで遷移してきた場合に、Dealerと言語を変更する
|
||||||
@ -371,18 +378,48 @@ const SignupInput: React.FC = (): JSX.Element => {
|
|||||||
setIsOpenPolicy(true);
|
setIsOpenPolicy(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t(getTranslationID("signupPage.label.termsLink"))}
|
{t(getTranslationID("signupPage.label.linkOfEula"))}
|
||||||
</a>
|
</a>
|
||||||
{` ${t(getTranslationID("signupPage.label.termsLinkFor"))} `}
|
{` ${t(getTranslationID("signupPage.label.forOdms"))} `}
|
||||||
<br />
|
<br />
|
||||||
<label htmlFor="check-box">
|
<label htmlFor="checkboxEula">
|
||||||
<input
|
<input
|
||||||
id="check-box"
|
id="checkboxEula"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
checked={isCheckedEula}
|
||||||
className={styles.formCheck}
|
className={styles.formCheck}
|
||||||
disabled={!isOpenPolicy}
|
disabled={!isOpenPolicy}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setIsAgreePolicy(e.target.checked);
|
setIsCheckedEula(e.target.checked);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{t(getTranslationID("signupPage.label.termsCheckBox"))}
|
||||||
|
</label>
|
||||||
|
</dd>
|
||||||
|
<dd className={`${styles.full} ${styles.alignCenter}`}>
|
||||||
|
<a
|
||||||
|
href="/"
|
||||||
|
target="_blank"
|
||||||
|
className={styles.linkTx}
|
||||||
|
onClick={() => {
|
||||||
|
setIsOpenPrivacyNoyice(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t(
|
||||||
|
getTranslationID("signupPage.label.linkOfPrivacyNotice")
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
|
{` ${t(getTranslationID("signupPage.label.forOdms"))} `}
|
||||||
|
<br />
|
||||||
|
<label htmlFor="checkboxPrivacyNotice">
|
||||||
|
<input
|
||||||
|
id="checkboxPrivacyNotice"
|
||||||
|
type="checkbox"
|
||||||
|
checked={isCheckedPrivacyNotice}
|
||||||
|
className={styles.formCheck}
|
||||||
|
disabled={!isOpenPrivacyNotice}
|
||||||
|
onChange={(e) => {
|
||||||
|
setIsCheckedPrivacyNotice(e.target.checked);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{t(getTranslationID("signupPage.label.termsCheckBox"))}
|
{t(getTranslationID("signupPage.label.termsCheckBox"))}
|
||||||
@ -396,8 +433,9 @@ const SignupInput: React.FC = (): JSX.Element => {
|
|||||||
getTranslationID("signupPage.label.createAccountButton")
|
getTranslationID("signupPage.label.createAccountButton")
|
||||||
)}
|
)}
|
||||||
className={`${styles.formSubmit}
|
className={`${styles.formSubmit}
|
||||||
${isAgreePolicy && styles.isActive}
|
${styles.marginBtm0}
|
||||||
${styles.marginBtm0}`}
|
${canClickButton() ? styles.isActive : ""}
|
||||||
|
`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsPushCreateButton(true);
|
setIsPushCreateButton(true);
|
||||||
onSubmit();
|
onSubmit();
|
||||||
|
|||||||
@ -101,6 +101,7 @@ export const TemplateFilePage: React.FC = () => {
|
|||||||
<td>{template.name}</td>
|
<td>{template.name}</td>
|
||||||
<td>
|
<td>
|
||||||
<ul className={`${styles.menuAction} ${styles.inTable}`}>
|
<ul className={`${styles.menuAction} ${styles.inTable}`}>
|
||||||
|
{/* テンプレートファイル削除はCCB後回し分なので非表示
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href=""
|
href=""
|
||||||
@ -109,6 +110,7 @@ export const TemplateFilePage: React.FC = () => {
|
|||||||
{t(getTranslationID("common.label.delete"))}
|
{t(getTranslationID("common.label.delete"))}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
*/}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -166,8 +166,9 @@ const TermsPage: React.FC = (): JSX.Element => {
|
|||||||
{` ${t(getTranslationID("termsPage.label.forOdms"))}`}
|
{` ${t(getTranslationID("termsPage.label.forOdms"))}`}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label htmlFor="checkboxEula">
|
||||||
<input
|
<input
|
||||||
|
id="checkboxEula"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={isCheckedEula}
|
checked={isCheckedEula}
|
||||||
className={styles.formCheck}
|
className={styles.formCheck}
|
||||||
@ -199,8 +200,9 @@ const TermsPage: React.FC = (): JSX.Element => {
|
|||||||
{` ${t(getTranslationID("termsPage.label.forOdms"))}`}
|
{` ${t(getTranslationID("termsPage.label.forOdms"))}`}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label htmlFor="checkboxPrivacyNotice">
|
||||||
<input
|
<input
|
||||||
|
id="checkboxPrivacyNotice"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={isCheckedPrivacyNotice}
|
checked={isCheckedPrivacyNotice}
|
||||||
className={styles.formCheck}
|
className={styles.formCheck}
|
||||||
@ -234,8 +236,9 @@ const TermsPage: React.FC = (): JSX.Element => {
|
|||||||
{` ${t(getTranslationID("termsPage.label.forOdms"))}`}
|
{` ${t(getTranslationID("termsPage.label.forOdms"))}`}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label htmlFor="checkboxDpa">
|
||||||
<input
|
<input
|
||||||
|
id="checkboxDpa"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={isCheckedDpa}
|
checked={isCheckedDpa}
|
||||||
className={styles.formCheck}
|
className={styles.formCheck}
|
||||||
|
|||||||
@ -243,6 +243,7 @@ const UserListPage: React.FC = (): JSX.Element => {
|
|||||||
</li>
|
</li>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{/* ユーザー削除 CCB後回し分なので今は非表示
|
||||||
<li>
|
<li>
|
||||||
<a href="">
|
<a href="">
|
||||||
{t(
|
{t(
|
||||||
@ -252,6 +253,7 @@ const UserListPage: React.FC = (): JSX.Element => {
|
|||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
*/}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td> {user.name}</td>
|
<td> {user.name}</td>
|
||||||
|
|||||||
@ -73,9 +73,9 @@
|
|||||||
"adminName": "Name des Administrators",
|
"adminName": "Name des Administrators",
|
||||||
"email": "E-Mail-Addresse",
|
"email": "E-Mail-Addresse",
|
||||||
"password": "Passwort",
|
"password": "Passwort",
|
||||||
"termsLink": "Klicken Sie hier, um die Nutzungsbedingungen zu lesen.",
|
"linkOfEula": "Klicken Sie hier, um die Endbenutzer-Lizenzvereinbarung zu lesen.",
|
||||||
"termsLinkFor": "für ODMS Cloud.",
|
"linkOfPrivacyNotice": "Klicken Sie hier, um die Datenschutzerklärung zu lesen.",
|
||||||
"termsCheckBox": "Ja, ich stimme den Nutzungsbedingungen zu.",
|
"forOdms": "für ODMS Cloud.",
|
||||||
"createAccountButton": "Einreichen"
|
"createAccountButton": "Einreichen"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -73,8 +73,9 @@
|
|||||||
"adminName": "Administrator‘s Name",
|
"adminName": "Administrator‘s Name",
|
||||||
"email": "Email Address",
|
"email": "Email Address",
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
"termsLink": "Click here to read the terms of use",
|
"linkOfEula": "Click here to read the End User License Agreement.",
|
||||||
"termsLinkFor": "for OMDS Cloud.",
|
"linkOfPrivacyNotice": "Click here to read the Privacy Notice.",
|
||||||
|
"forOdms": "for ODMS Cloud.",
|
||||||
"termsCheckBox": "Yes, I agree to the terms of use.",
|
"termsCheckBox": "Yes, I agree to the terms of use.",
|
||||||
"createAccountButton": "Submit"
|
"createAccountButton": "Submit"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,8 +73,9 @@
|
|||||||
"adminName": "Nombre del administrador",
|
"adminName": "Nombre del administrador",
|
||||||
"email": "Dirección de correo electrónico",
|
"email": "Dirección de correo electrónico",
|
||||||
"password": "Contraseña",
|
"password": "Contraseña",
|
||||||
"termsLink": "Haga clic aquí para leer el término de uso.",
|
"linkOfEula": "Haga clic aquí para leer el Acuerdo de licencia de usuario final.",
|
||||||
"termsLinkFor": "para la nube ODMS.",
|
"linkOfPrivacyNotice": "Haga clic aquí para leer el Aviso de Privacidad.",
|
||||||
|
"forOdms": "para la nube ODMS.",
|
||||||
"termsCheckBox": "Sí, estoy de acuerdo con los términos de uso.",
|
"termsCheckBox": "Sí, estoy de acuerdo con los términos de uso.",
|
||||||
"createAccountButton": "Entregar"
|
"createAccountButton": "Entregar"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,8 +73,9 @@
|
|||||||
"adminName": "Nom de l'administrateur",
|
"adminName": "Nom de l'administrateur",
|
||||||
"email": "Adresse e-mail",
|
"email": "Adresse e-mail",
|
||||||
"password": "Mot de passe",
|
"password": "Mot de passe",
|
||||||
"termsLink": "Cliquez ici pour lire les conditions d'utilisation.",
|
"linkOfEula": "Cliquez ici pour lire le contrat de licence utilisateur final.",
|
||||||
"termsLinkFor": "pour ODMS Cloud.",
|
"linkOfPrivacyNotice": "Cliquez ici pour lire l'avis de confidentialité.",
|
||||||
|
"forOdms": "pour ODMS Cloud.",
|
||||||
"termsCheckBox": "Oui, j'accepte les conditions d'utilisation.",
|
"termsCheckBox": "Oui, j'accepte les conditions d'utilisation.",
|
||||||
"createAccountButton": "Soumettre"
|
"createAccountButton": "Soumettre"
|
||||||
}
|
}
|
||||||
|
|||||||
20
dictation_function/package-lock.json
generated
20
dictation_function/package-lock.json
generated
@ -20,8 +20,10 @@
|
|||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^27.5.0",
|
||||||
"@types/node": "18.x",
|
"@types/node": "18.x",
|
||||||
"@types/redis": "^2.8.13",
|
"@types/redis": "^2.8.13",
|
||||||
|
"@types/redis-mock": "^0.17.3",
|
||||||
"azure-functions-core-tools": "^4.x",
|
"azure-functions-core-tools": "^4.x",
|
||||||
"jest": "^28.0.3",
|
"jest": "^28.0.3",
|
||||||
|
"redis-mock": "^0.56.3",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
"sqlite3": "^5.1.6",
|
"sqlite3": "^5.1.6",
|
||||||
"supertest": "^6.1.3",
|
"supertest": "^6.1.3",
|
||||||
@ -2000,6 +2002,15 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/redis-mock": {
|
||||||
|
"version": "0.17.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/redis-mock/-/redis-mock-0.17.3.tgz",
|
||||||
|
"integrity": "sha512-1baXyGxRKEDog8p1ReiypODwiST2n3/0pBbgUKEuv9pBXnY6ttRzKATcW5Xz20ZOl9qkKtPIeq20tHgHSdQBAQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/redis": "^2.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/stack-utils": {
|
"node_modules/@types/stack-utils": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.2.tgz",
|
||||||
@ -6409,6 +6420,15 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/redis-mock": {
|
||||||
|
"version": "0.56.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/redis-mock/-/redis-mock-0.56.3.tgz",
|
||||||
|
"integrity": "sha512-ynaJhqk0Qf3Qajnwvy4aOjS4Mdf9IBkELWtjd+NYhpiqu4QCNq6Vf3Q7c++XRPGiKiwRj9HWr0crcwy7EiPjYQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/redis-parser": {
|
"node_modules/redis-parser": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz",
|
||||||
|
|||||||
@ -25,8 +25,10 @@
|
|||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^27.5.0",
|
||||||
"@types/node": "18.x",
|
"@types/node": "18.x",
|
||||||
"@types/redis": "^2.8.13",
|
"@types/redis": "^2.8.13",
|
||||||
|
"@types/redis-mock": "^0.17.3",
|
||||||
"azure-functions-core-tools": "^4.x",
|
"azure-functions-core-tools": "^4.x",
|
||||||
"jest": "^28.0.3",
|
"jest": "^28.0.3",
|
||||||
|
"redis-mock": "^0.56.3",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
"sqlite3": "^5.1.6",
|
"sqlite3": "^5.1.6",
|
||||||
"supertest": "^6.1.3",
|
"supertest": "^6.1.3",
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export async function licenseAlertProcessing(
|
|||||||
const keys = await keysAsync(`${SEND_COMPLETE_PREFIX}${formattedDate}*`);
|
const keys = await keysAsync(`${SEND_COMPLETE_PREFIX}${formattedDate}*`);
|
||||||
console.log(`delete terget:${keys}`);
|
console.log(`delete terget:${keys}`);
|
||||||
if (keys.length > 0) {
|
if (keys.length > 0) {
|
||||||
const delResult = await delAsync(...keys);
|
const delResult = await delAsync(keys);
|
||||||
console.log(`delete number:${delResult}`);
|
console.log(`delete number:${delResult}`);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -13,13 +13,15 @@ import { ADB2C_SIGN_IN_TYPE } from "../constants";
|
|||||||
import { SendGridService } from "../sendgrid/sendgrid";
|
import { SendGridService } from "../sendgrid/sendgrid";
|
||||||
import { AdB2cService } from "../adb2c/adb2c";
|
import { AdB2cService } from "../adb2c/adb2c";
|
||||||
import { InvocationContext } from "@azure/functions";
|
import { InvocationContext } from "@azure/functions";
|
||||||
import { RedisClient } from "redis";
|
import { RedisClient, createClient } from "redis-mock";
|
||||||
import { createRedisClient } from "../redis/redis";
|
import { promisify } from "util";
|
||||||
|
|
||||||
describe("licenseAlert", () => {
|
describe("licenseAlert", () => {
|
||||||
dotenv.config({ path: ".env" });
|
dotenv.config({ path: ".env" });
|
||||||
dotenv.config({ path: ".env.local", override: true });
|
dotenv.config({ path: ".env.local", override: true });
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
|
const redisClient = createClient();
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
source = new DataSource({
|
source = new DataSource({
|
||||||
type: "sqlite",
|
type: "sqlite",
|
||||||
@ -35,17 +37,15 @@ describe("licenseAlert", () => {
|
|||||||
if (!source) return;
|
if (!source) return;
|
||||||
await source.destroy();
|
await source.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
|
//licenseAlertProcessingの処理の最後にキャッシュ削除処理があるため、ここでクリーンアップは行わない
|
||||||
});
|
});
|
||||||
|
|
||||||
it("テストを通すための仮", async () => {});
|
|
||||||
/*
|
|
||||||
|
|
||||||
it("ライセンス在庫不足メールが送信され、ライセンス失効警告メールが送信されないこと", async () => {
|
it("ライセンス在庫不足メールが送信され、ライセンス失効警告メールが送信されないこと", async () => {
|
||||||
if (!source) fail();
|
if (!source) fail();
|
||||||
const context = new InvocationContext();
|
const context = new InvocationContext();
|
||||||
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
||||||
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
||||||
const redisClient = createRedisClient();
|
|
||||||
// 呼び出し回数でテスト成否を判定
|
// 呼び出し回数でテスト成否を判定
|
||||||
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
||||||
|
|
||||||
@ -77,7 +77,10 @@ describe("licenseAlert", () => {
|
|||||||
adb2cMock
|
adb2cMock
|
||||||
);
|
);
|
||||||
expect(spySend.mock.calls).toHaveLength(1);
|
expect(spySend.mock.calls).toHaveLength(1);
|
||||||
redisClient.quit;
|
// redisからキャッシュが削除されていることを確認
|
||||||
|
const getAsync = promisify(redisClient.keys).bind(redisClient);
|
||||||
|
const keys = await getAsync(`*`);
|
||||||
|
expect(keys).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("ライセンス在庫不足メール、ライセンス失効警告メールが送信されること", async () => {
|
it("ライセンス在庫不足メール、ライセンス失効警告メールが送信されること", async () => {
|
||||||
@ -85,7 +88,6 @@ describe("licenseAlert", () => {
|
|||||||
const context = new InvocationContext();
|
const context = new InvocationContext();
|
||||||
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
||||||
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
||||||
const redisClient = createRedisClient();
|
|
||||||
|
|
||||||
// 呼び出し回数でテスト成否を判定
|
// 呼び出し回数でテスト成否を判定
|
||||||
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
||||||
@ -118,7 +120,10 @@ describe("licenseAlert", () => {
|
|||||||
adb2cMock
|
adb2cMock
|
||||||
);
|
);
|
||||||
expect(spySend.mock.calls).toHaveLength(2);
|
expect(spySend.mock.calls).toHaveLength(2);
|
||||||
redisClient.quit;
|
// redisからキャッシュが削除されていることを確認
|
||||||
|
const getAsync = promisify(redisClient.keys).bind(redisClient);
|
||||||
|
const keys = await getAsync(`*`);
|
||||||
|
expect(keys).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("在庫があるため、ライセンス在庫不足メールが送信されないこと", async () => {
|
it("在庫があるため、ライセンス在庫不足メールが送信されないこと", async () => {
|
||||||
@ -126,7 +131,6 @@ describe("licenseAlert", () => {
|
|||||||
const context = new InvocationContext();
|
const context = new InvocationContext();
|
||||||
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
||||||
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
||||||
const redisClient = createRedisClient();
|
|
||||||
|
|
||||||
// 呼び出し回数でテスト成否を判定
|
// 呼び出し回数でテスト成否を判定
|
||||||
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
||||||
@ -172,7 +176,10 @@ describe("licenseAlert", () => {
|
|||||||
adb2cMock
|
adb2cMock
|
||||||
);
|
);
|
||||||
expect(spySend.mock.calls).toHaveLength(0);
|
expect(spySend.mock.calls).toHaveLength(0);
|
||||||
redisClient.quit;
|
// redisからキャッシュが削除されていることを確認
|
||||||
|
const getAsync = promisify(redisClient.keys).bind(redisClient);
|
||||||
|
const keys = await getAsync(`*`);
|
||||||
|
expect(keys).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("AutoRenewがtureのため、ライセンス失効警告メールが送信されないこと", async () => {
|
it("AutoRenewがtureのため、ライセンス失効警告メールが送信されないこと", async () => {
|
||||||
@ -180,7 +187,6 @@ describe("licenseAlert", () => {
|
|||||||
const context = new InvocationContext();
|
const context = new InvocationContext();
|
||||||
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
const sendgridMock = new SendGridServiceMock() as SendGridService;
|
||||||
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
const adb2cMock = new AdB2cServiceMock() as AdB2cService;
|
||||||
const redisClient = createRedisClient();
|
|
||||||
|
|
||||||
// 呼び出し回数でテスト成否を判定
|
// 呼び出し回数でテスト成否を判定
|
||||||
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
const spySend = jest.spyOn(sendgridMock, "sendMail");
|
||||||
@ -213,9 +219,11 @@ describe("licenseAlert", () => {
|
|||||||
adb2cMock
|
adb2cMock
|
||||||
);
|
);
|
||||||
expect(spySend.mock.calls).toHaveLength(1);
|
expect(spySend.mock.calls).toHaveLength(1);
|
||||||
redisClient.quit;
|
// redisからキャッシュが削除されていることを確認
|
||||||
|
const getAsync = promisify(redisClient.keys).bind(redisClient);
|
||||||
|
const keys = await getAsync(`*`);
|
||||||
|
expect(keys).toHaveLength(0);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// テスト用sendgrid
|
// テスト用sendgrid
|
||||||
|
|||||||
@ -282,13 +282,9 @@ describe("licenseAutoAllocation", () => {
|
|||||||
it("有効期限が指定日のライセンスが自動更新されること(リトライ用)", async () => {
|
it("有効期限が指定日のライセンスが自動更新されること(リトライ用)", async () => {
|
||||||
if (!source) fail();
|
if (!source) fail();
|
||||||
const context = new InvocationContext();
|
const context = new InvocationContext();
|
||||||
// 11/22の日付を作成
|
// 2023/11/22の日付を作成
|
||||||
const dateSeptember22 = new Date();
|
const date1122 = new Date(2023, 10, 22, 23, 59, 59);
|
||||||
dateSeptember22.setMonth(11);
|
const currentDateEndTime = new DateWithDayEndTime(date1122);
|
||||||
dateSeptember22.setDate(22);
|
|
||||||
dateSeptember22.setHours(23, 59, 59);
|
|
||||||
const currentDateEndTime = new DateWithDayEndTime(dateSeptember22);
|
|
||||||
|
|
||||||
// アカウント
|
// アカウント
|
||||||
const account1 = await makeTestAccount(
|
const account1 = await makeTestAccount(
|
||||||
source,
|
source,
|
||||||
@ -328,7 +324,7 @@ describe("licenseAutoAllocation", () => {
|
|||||||
auto_renew: false,
|
auto_renew: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 割り当て済みで有効期限が12/31のライセンス
|
// 割り当て済みで有効期限が11/22のライセンス
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -389,10 +385,9 @@ describe("licenseAutoAllocation", () => {
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
// 割り当て済みの更新対象ではないライセンス
|
// 割り当て済みの更新対象ではないライセンス
|
||||||
const nextDate = new Date();
|
const nextDate = new Date();
|
||||||
nextDate.setDate(dateSeptember22.getDate() + 1);
|
nextDate.setDate(date1122.getDate() + 1);
|
||||||
nextDate.setHours(23, 59, 59); // 時分秒を"23:59:59"に固定
|
nextDate.setHours(23, 59, 59); // 時分秒を"23:59:59"に固定
|
||||||
nextDate.setMilliseconds(0);
|
nextDate.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
@ -407,15 +402,13 @@ describe("licenseAutoAllocation", () => {
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
// 有効期限が先の未割当ライセンスを作成
|
// 有効期限が先の未割当ライセンスを作成
|
||||||
// idが100のものは有効期限が当日なので自動割り当て対象外
|
// idが100のものは有効期限が当日なので自動割り当て対象外
|
||||||
// idが101のものから割り当てられる
|
// idが101のものから割り当てられる
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
const date = new Date();
|
// 2023/11/22の日付を作成
|
||||||
date.setDate(dateSeptember22.getDate() + i);
|
const date = new Date(2023, 10, 22, 23, 59, 59);
|
||||||
date.setHours(23, 59, 59); // 時分秒を"23:59:59"に固定
|
date.setDate(date.getDate() + i);
|
||||||
date.setMilliseconds(0);
|
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
i + 100,
|
i + 100,
|
||||||
@ -446,8 +439,7 @@ describe("licenseAutoAllocation", () => {
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
await licenseAutoAllocationProcessing(context, source, date1122);
|
||||||
await licenseAutoAllocationProcessing(context, source, dateSeptember22);
|
|
||||||
const user1Allocated = await selectLicenseByAllocatedUser(source, user1.id);
|
const user1Allocated = await selectLicenseByAllocatedUser(source, user1.id);
|
||||||
const user2Allocated = await selectLicenseByAllocatedUser(source, user2.id);
|
const user2Allocated = await selectLicenseByAllocatedUser(source, user2.id);
|
||||||
const user3Allocated = await selectLicenseByAllocatedUser(source, user3.id);
|
const user3Allocated = await selectLicenseByAllocatedUser(source, user3.id);
|
||||||
|
|||||||
@ -2,6 +2,7 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
dictation_server:
|
dictation_server:
|
||||||
|
container_name: dictation_server_dev_container
|
||||||
env_file: ../.env
|
env_file: ../.env
|
||||||
build: .
|
build: .
|
||||||
working_dir: /app/dictation_server
|
working_dir: /app/dictation_server
|
||||||
@ -16,6 +17,15 @@ services:
|
|||||||
- CHOKIDAR_USEPOLLING=true
|
- CHOKIDAR_USEPOLLING=true
|
||||||
networks:
|
networks:
|
||||||
- external
|
- external
|
||||||
|
test_mysql_db:
|
||||||
|
image: mysql:8.0-bullseye
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: root_password
|
||||||
|
MYSQL_DATABASE: odms
|
||||||
|
MYSQL_USER: user
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
networks:
|
||||||
|
- external
|
||||||
networks:
|
networks:
|
||||||
external:
|
external:
|
||||||
name: omds_network
|
name: omds_network
|
||||||
|
|||||||
35
dictation_server/.devcontainer/pipeline-docker-compose.yml
Normal file
35
dictation_server/.devcontainer/pipeline-docker-compose.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
dictation_server:
|
||||||
|
container_name: dictation_server_dev_container
|
||||||
|
env_file: ../.env
|
||||||
|
build: .
|
||||||
|
working_dir: /app/dictation_server
|
||||||
|
ports:
|
||||||
|
- '8081:8081'
|
||||||
|
volumes:
|
||||||
|
- ../../:/app
|
||||||
|
- node_modules:/app/dictation_server/node_modules
|
||||||
|
expose:
|
||||||
|
- '8081'
|
||||||
|
environment:
|
||||||
|
- CHOKIDAR_USEPOLLING=true
|
||||||
|
depends_on:
|
||||||
|
- test_mysql_db
|
||||||
|
networks:
|
||||||
|
- network
|
||||||
|
test_mysql_db:
|
||||||
|
image: mysql:8.0-bullseye
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: root_password
|
||||||
|
MYSQL_DATABASE: odms
|
||||||
|
MYSQL_USER: user
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
networks:
|
||||||
|
- network
|
||||||
|
networks:
|
||||||
|
network:
|
||||||
|
name: test_network
|
||||||
|
volumes:
|
||||||
|
node_modules:
|
||||||
37
dictation_server/.env.test
Normal file
37
dictation_server/.env.test
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
STAGE=local
|
||||||
|
NO_COLOR=TRUE
|
||||||
|
CORS=TRUE
|
||||||
|
PORT=8081
|
||||||
|
TENANT_NAME=xxxxxxxxxx
|
||||||
|
SIGNIN_FLOW_NAME=b2c_1_signin_xxx
|
||||||
|
ADB2C_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||||
|
ADB2C_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||||
|
ADB2C_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
ADB2C_ORIGIN=https://example.com/xxxxxxxxx.onmicrosoft.com/b2c_1_signin_xxx/
|
||||||
|
KEY_VAULT_NAME=xxxxxxxxxxxx
|
||||||
|
JWT_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA5IZZNgDew9eGmuFTezwdHYLSaJvUPPIKYoiOeVLD1paWNI51\n7Vkaoh0ngprcKOdv6T1N07V4igK7mOim2zY3yCTR6wcWR3PfFJrl9vh5SOo79koZ\noJb27YiM4jtxfx2dezzp0T2GoNR5rRolPUbWFJXnDe0DVXYXpJLb4LAlF2XAyYX0\nSYKUVUsJnzm5k4xbXtnwPwVbpm0EdswBE6qSfiL9zWk9dvHoKzSnfSDzDFoFcEoV\nchawzYXf/MM1YR4wo5XyzECc6Q5Ah4z522//mBNNaDHv83Yuw3mGShT73iJ0JQdk\nTturshv2Ecma38r6ftrIwNYXw4VVatJM8+GOOQIDAQABAoIBADrwp7u097+dK/tw\nWD61n3DIGAqg/lmFt8X4IH8MKLSE/FKr16CS1bqwOEuIM3ZdUtDeXd9Xs7IsyEPE\n5ZwuXK7DSF0M4+Mj8Ip49Q0Aww9aUoLQU9HGfgN/r4599GTrt31clZXA/6Mlighq\ncOZgCcEfdItz8OMu5SQuOIW4CKkCuaWnPOP26UqZocaXNZfpZH0iFLATMMH/TT8x\nay9ToHTQYE17ijdQ/EOLSwoeDV1CU1CIE3P4YfLJjvpKptly5dTevriHEzBi70Jx\n/KEPUn9Jj2gZafrUxRVhmMbm1zkeYxL3gsqRuTzRjEeeILuZhSJyCkQZyUNARxsg\nQY4DZfECgYEA+YLKUtmYTx60FS6DJ4s31TAsXY8kwhq/lB9E3GBZKDd0DPayXEeK\n4UWRQDTT6MI6fedW69FOZJ5sFLp8HQpcssb4Weq9PCpDhNTx8MCbdH3Um5QR3vfW\naKq/1XM8MDUnx5XcNYd87Aw3azvJAvOPr69as8IPnj6sKaRR9uQjbYUCgYEA6nfV\n5j0qmn0EJXZJblk4mvvjLLoWSs17j9YlrZJlJxXMDFRYtgnelv73xMxOMvcGoxn5\nifs7dpaM2x5EmA6jVU5sYaB/beZGEPWqPYGyjIwXPvUGAAv8Gbnvpp+xlSco/Dum\nIq0w+43ry5/xWh6CjfrvKV0J2bDOiJwPEdu/8iUCgYEAnBBSvL+dpN9vhFAzeOh7\nY71eAqcmNsLEUcG9MJqTKbSFwhYMOewF0iHRWHeylEPokhfBJn8kqYrtz4lVWFTC\n5o/Nh3BsLNXCpbMMIapXkeWiti1HgE9ErPMgSkJpwz18RDpYIqM8X+jEQS6D7HSr\nyxfDg+w+GJza0rEVE3hfMIECgYBw+KZ2VfhmEWBjEHhXE+QjQMR3s320MwebCUqE\nNCpKx8TWF/naVC0MwfLtvqbbBY0MHyLN6d//xpA9r3rLbRojqzKrY2KiuDYAS+3n\nzssRzxoQOozWju+8EYu30/ADdqfXyIHG6X3VZs87AGiQzGyJLmP3oR1y5y7MQa09\nJI16hQKBgHK5uwJhGa281Oo5/FwQ3uYLymbNwSGrsOJXiEu2XwJEXwVi2ELOKh4/\n03pBk3Kva3fIwEK+vCzDNnxShIQqBE76/2I1K1whOfoUehhYvKHGaXl2j70Zz9Ks\nrkGW1cx7p+yDqATDrwHBHTHFh5bUTTn8dN40n0e0W/llurpbBkJM\n-----END RSA PRIVATE KEY-----\n"
|
||||||
|
JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5IZZNgDew9eGmuFTezwd\nHYLSaJvUPPIKYoiOeVLD1paWNI517Vkaoh0ngprcKOdv6T1N07V4igK7mOim2zY3\nyCTR6wcWR3PfFJrl9vh5SOo79koZoJb27YiM4jtxfx2dezzp0T2GoNR5rRolPUbW\nFJXnDe0DVXYXpJLb4LAlF2XAyYX0SYKUVUsJnzm5k4xbXtnwPwVbpm0EdswBE6qS\nfiL9zWk9dvHoKzSnfSDzDFoFcEoVchawzYXf/MM1YR4wo5XyzECc6Q5Ah4z522//\nmBNNaDHv83Yuw3mGShT73iJ0JQdkTturshv2Ecma38r6ftrIwNYXw4VVatJM8+GO\nOQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||||
|
SENDGRID_API_KEY=SG.P_xxxx_xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxx-pc
|
||||||
|
MAIL_FROM=noreply@example.com
|
||||||
|
NOTIFICATION_HUB_NAME=ntf-odms-dev
|
||||||
|
NOTIFICATION_HUB_CONNECT_STRING=Endpoint=sb://example.com/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
|
||||||
|
APP_DOMAIN=http://localhost:8081/
|
||||||
|
STORAGE_TOKEN_EXPIRE_TIME=30
|
||||||
|
STORAGE_ACCOUNT_NAME_US=saxxxxusxxx
|
||||||
|
STORAGE_ACCOUNT_NAME_AU=saxxxxauxxx
|
||||||
|
STORAGE_ACCOUNT_NAME_EU=saxxxxeuxxx
|
||||||
|
STORAGE_ACCOUNT_KEY_US=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==
|
||||||
|
STORAGE_ACCOUNT_KEY_AU=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==
|
||||||
|
STORAGE_ACCOUNT_KEY_EU=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==
|
||||||
|
STORAGE_ACCOUNT_ENDPOINT_US=https://xxxxxxxxxxxx.blob.core.windows.net/
|
||||||
|
STORAGE_ACCOUNT_ENDPOINT_AU=https://xxxxxxxxxxxx.blob.core.windows.net/
|
||||||
|
STORAGE_ACCOUNT_ENDPOINT_EU=https://xxxxxxxxxxxx.blob.core.windows.net/
|
||||||
|
ACCESS_TOKEN_LIFETIME_WEB=7200000
|
||||||
|
REFRESH_TOKEN_LIFETIME_WEB=86400000
|
||||||
|
REFRESH_TOKEN_LIFETIME_DEFAULT=2592000000
|
||||||
|
EMAIL_CONFIRM_LIFETIME=86400000
|
||||||
|
REDIS_HOST=redis-cache
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_PASSWORD=omdsredispass
|
||||||
|
ADB2C_CACHE_TTL=86400
|
||||||
|
TEMPLATE_ROOT=dist
|
||||||
@ -10,3 +10,7 @@ ci:
|
|||||||
dialect: mysql
|
dialect: mysql
|
||||||
dir: ./dictation_server/db/migrations
|
dir: ./dictation_server/db/migrations
|
||||||
datasource: DB_USERNAME:DB_PASS@tcp(DB_HOST:DB_PORT)/DB_NAME?charset=utf8mb4&collation=utf8mb4_0900_ai_ci&parseTime=true
|
datasource: DB_USERNAME:DB_PASS@tcp(DB_HOST:DB_PORT)/DB_NAME?charset=utf8mb4&collation=utf8mb4_0900_ai_ci&parseTime=true
|
||||||
|
test:
|
||||||
|
dialect: mysql
|
||||||
|
dir: /app/dictation_server/db/migrations
|
||||||
|
datasource: user:password@tcp(test_mysql_db:3306)/odms?charset=utf8mb4&collation=utf8mb4_0900_ai_ci&parseTime=true
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
-- +migrate Up
|
||||||
|
ALTER TABLE `users_archive` DROP COLUMN `license_alert`;
|
||||||
|
|
||||||
|
|
||||||
|
-- +migrate Down
|
||||||
|
ALTER TABLE `users_archive` ADD COLUMN `license_alert` BOOLEAN NOT NULL COMMENT 'ライセンスの期限切れ通知をするかどうか';
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"tc": "tsc --noEmit",
|
"tc": "tsc --noEmit",
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
||||||
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
"test": "jest",
|
"test": "jest -w 1",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:cov": "jest --coverage",
|
"test:cov": "jest --coverage",
|
||||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||||
@ -26,7 +26,8 @@
|
|||||||
"openapi-format": "cat \"src/api/odms/openapi.json\" | jq -c . > \"src/api/odms/openapi.json\" && prettier --write \"src/api/odms/*.json\"",
|
"openapi-format": "cat \"src/api/odms/openapi.json\" | jq -c . > \"src/api/odms/openapi.json\" && prettier --write \"src/api/odms/*.json\"",
|
||||||
"migrate:up": "sql-migrate up -config=/app/dictation_server/db/dbconfig.yml -env=ccb",
|
"migrate:up": "sql-migrate up -config=/app/dictation_server/db/dbconfig.yml -env=ccb",
|
||||||
"migrate:down": "sql-migrate down -config=/app/dictation_server/db/dbconfig.yml -env=ccb",
|
"migrate:down": "sql-migrate down -config=/app/dictation_server/db/dbconfig.yml -env=ccb",
|
||||||
"migrate:status": "sql-migrate status -config=/app/dictation_server/db/dbconfig.yml -env=ccb"
|
"migrate:status": "sql-migrate status -config=/app/dictation_server/db/dbconfig.yml -env=ccb",
|
||||||
|
"migrate:up:test": "sql-migrate up -config=/app/dictation_server/db/dbconfig.yml -env=test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/identity": "^3.1.3",
|
"@azure/identity": "^3.1.3",
|
||||||
|
|||||||
21
dictation_server/src/common/test/init.ts
Normal file
21
dictation_server/src/common/test/init.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { DataSource } from "typeorm";
|
||||||
|
|
||||||
|
export const truncateAllTable = async (source: DataSource) => {
|
||||||
|
const entities = source.entityMetadatas;
|
||||||
|
const queryRunner = source.createQueryRunner();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await queryRunner.startTransaction();
|
||||||
|
await queryRunner.query('SET FOREIGN_KEY_CHECKS=0');
|
||||||
|
for (const entity of entities) {
|
||||||
|
await queryRunner.query(`TRUNCATE TABLE \`${entity.tableName}\``);
|
||||||
|
}
|
||||||
|
await queryRunner.query('SET FOREIGN_KEY_CHECKS=1');
|
||||||
|
await queryRunner.commitTransaction();
|
||||||
|
} catch (err) {
|
||||||
|
await queryRunner.rollbackTransaction();
|
||||||
|
throw err;
|
||||||
|
} finally {
|
||||||
|
await queryRunner.release();
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -48,7 +48,7 @@ export const makeTestingModule = async (
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
AuthModule,
|
AuthModule,
|
||||||
|
|||||||
@ -88,6 +88,16 @@ export const USER_ROLES = {
|
|||||||
TYPIST: 'typist',
|
TYPIST: 'typist',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ロールのソート順
|
||||||
|
* @const {string[]}
|
||||||
|
*/
|
||||||
|
export const USER_ROLE_ORDERS = [
|
||||||
|
USER_ROLES.AUTHOR,
|
||||||
|
USER_ROLES.TYPIST,
|
||||||
|
USER_ROLES.NONE,
|
||||||
|
] as string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ライセンス注文状態
|
* ライセンス注文状態
|
||||||
* @const {string[]}
|
* @const {string[]}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ describe('AccountsController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@ describe('AuthController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|||||||
import { TIERS, USER_ROLES } from '../../constants';
|
import { TIERS, USER_ROLES } from '../../constants';
|
||||||
import { decode, isVerifyError } from '../../common/jwt';
|
import { decode, isVerifyError } from '../../common/jwt';
|
||||||
import { RefreshToken, AccessToken } from '../../common/token';
|
import { RefreshToken, AccessToken } from '../../common/token';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('AuthService', () => {
|
describe('AuthService', () => {
|
||||||
it('IDトークンの検証とペイロードの取得に成功する', async () => {
|
it('IDトークンの検証とペイロードの取得に成功する', async () => {
|
||||||
@ -162,20 +163,32 @@ describe('AuthService', () => {
|
|||||||
|
|
||||||
describe('checkIsAcceptedLatestVersion', () => {
|
describe('checkIsAcceptedLatestVersion', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
it('同意済み利用規約バージョンが最新のときにチェックが通ること(第五)', async () => {
|
it('同意済み利用規約バージョンが最新のときにチェックが通ること(第五)', async () => {
|
||||||
@ -325,20 +338,32 @@ describe('checkIsAcceptedLatestVersion', () => {
|
|||||||
|
|
||||||
describe('generateDelegationRefreshToken', () => {
|
describe('generateDelegationRefreshToken', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
it('代行操作が許可されたパートナーの代行操作用リフレッシュトークンを取得できること', async () => {
|
it('代行操作が許可されたパートナーの代行操作用リフレッシュトークンを取得できること', async () => {
|
||||||
@ -459,20 +484,32 @@ describe('generateDelegationRefreshToken', () => {
|
|||||||
|
|
||||||
describe('generateDelegationAccessToken', () => {
|
describe('generateDelegationAccessToken', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
it('代行操作用リフレッシュトークンから代行操作用アクセストークンを取得できること', async () => {
|
it('代行操作用リフレッシュトークンから代行操作用アクセストークンを取得できること', async () => {
|
||||||
@ -558,20 +595,32 @@ describe('generateDelegationAccessToken', () => {
|
|||||||
|
|
||||||
describe('updateDelegationAccessToken', () => {
|
describe('updateDelegationAccessToken', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -743,7 +792,7 @@ describe('updateDelegationAccessToken', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 代行操作対象アカウントを削除
|
// 代行操作対象アカウントを削除
|
||||||
deleteAccount(source, partnerAccount.id);
|
await deleteAccount(source, partnerAccount.id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await service.updateDelegationAccessToken(
|
await service.updateDelegationAccessToken(
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('FilesController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -40,23 +40,36 @@ import {
|
|||||||
TASK_STATUS,
|
TASK_STATUS,
|
||||||
USER_ROLES,
|
USER_ROLES,
|
||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('publishUploadSas', () => {
|
describe('publishUploadSas', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -287,20 +300,32 @@ describe('publishUploadSas', () => {
|
|||||||
|
|
||||||
describe('タスク作成から自動ルーティング(DB使用)', () => {
|
describe('タスク作成から自動ルーティング(DB使用)', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
it('タスク作成時に、自動ルーティングを行うことができる(APIの引数として渡されたAuthorIDとworkType)', async () => {
|
it('タスク作成時に、自動ルーティングを行うことができる(APIの引数として渡されたAuthorIDとworkType)', async () => {
|
||||||
@ -997,20 +1022,32 @@ describe('タスク作成から自動ルーティング(DB使用)', () => {
|
|||||||
|
|
||||||
describe('音声ファイルダウンロードURL取得', () => {
|
describe('音声ファイルダウンロードURL取得', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1490,20 +1527,32 @@ describe('音声ファイルダウンロードURL取得', () => {
|
|||||||
|
|
||||||
describe('テンプレートファイルダウンロードURL取得', () => {
|
describe('テンプレートファイルダウンロードURL取得', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1933,20 +1982,32 @@ describe('テンプレートファイルダウンロードURL取得', () => {
|
|||||||
|
|
||||||
describe('publishTemplateFileUploadSas', () => {
|
describe('publishTemplateFileUploadSas', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2036,20 +2097,32 @@ describe('publishTemplateFileUploadSas', () => {
|
|||||||
|
|
||||||
describe('templateUploadFinished', () => {
|
describe('templateUploadFinished', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,7 @@ export const makeTestingModuleWithBlobAndNotification = async (
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
AuthModule,
|
AuthModule,
|
||||||
|
|||||||
@ -11,7 +11,7 @@ describe('LicensesController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -26,23 +26,36 @@ import {
|
|||||||
} from '../../common/test/utility';
|
} from '../../common/test/utility';
|
||||||
import { LicensesRepositoryService } from '../../repositories/licenses/licenses.repository.service';
|
import { LicensesRepositoryService } from '../../repositories/licenses/licenses.repository.service';
|
||||||
import { overrideSendgridService } from '../../common/test/overrides';
|
import { overrideSendgridService } from '../../common/test/overrides';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('ライセンス注文', () => {
|
describe('ライセンス注文', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -190,20 +203,32 @@ describe('ライセンス注文', () => {
|
|||||||
|
|
||||||
describe('カードライセンス発行', () => {
|
describe('カードライセンス発行', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -268,20 +293,32 @@ describe('カードライセンス発行', () => {
|
|||||||
|
|
||||||
describe('カードライセンスを取り込む', () => {
|
describe('カードライセンスを取り込む', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
it('カードライセンス取り込みが完了する', async () => {
|
it('カードライセンス取り込みが完了する', async () => {
|
||||||
@ -601,20 +638,32 @@ describe('カードライセンスを取り込む', () => {
|
|||||||
|
|
||||||
describe('ライセンス割り当て', () => {
|
describe('ライセンス割り当て', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -702,6 +751,7 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -768,6 +818,8 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
|
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -874,6 +926,7 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -939,6 +992,7 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -1004,6 +1058,7 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -1069,6 +1124,7 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() - 30);
|
date.setDate(date.getDate() - 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -1110,6 +1166,7 @@ describe('ライセンス割り当て', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -1161,20 +1218,32 @@ describe('ライセンス割り当て', () => {
|
|||||||
|
|
||||||
describe('ライセンス割り当て解除', () => {
|
describe('ライセンス割り当て解除', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1192,6 +1261,7 @@ describe('ライセンス割り当て解除', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -1271,6 +1341,7 @@ describe('ライセンス割り当て解除', () => {
|
|||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setDate(date.getDate() + 30);
|
date.setDate(date.getDate() + 30);
|
||||||
|
date.setMilliseconds(0);
|
||||||
await createLicense(
|
await createLicense(
|
||||||
source,
|
source,
|
||||||
1,
|
1,
|
||||||
@ -1316,20 +1387,32 @@ describe('ライセンス割り当て解除', () => {
|
|||||||
|
|
||||||
describe('ライセンス注文キャンセル', () => {
|
describe('ライセンス注文キャンセル', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -172,6 +172,7 @@ export const selectLicenseAllocationHistory = async (
|
|||||||
license_id: licence_id,
|
license_id: licence_id,
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
|
id: 'DESC',
|
||||||
executed_at: 'DESC',
|
executed_at: 'DESC',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('NotificationController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export const makeNotificationServiceMock = async (
|
|||||||
providers: [NotificationService],
|
providers: [NotificationService],
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('TasksController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -41,6 +41,7 @@ import { Roles } from '../../common/types/role';
|
|||||||
import { TasksRepositoryService } from '../../repositories/tasks/tasks.repository.service';
|
import { TasksRepositoryService } from '../../repositories/tasks/tasks.repository.service';
|
||||||
import { overrideBlobstorageService } from '../../common/test/overrides';
|
import { overrideBlobstorageService } from '../../common/test/overrides';
|
||||||
import { BlobstorageService } from '../../gateways/blobstorage/blobstorage.service';
|
import { BlobstorageService } from '../../gateways/blobstorage/blobstorage.service';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('TasksService', () => {
|
describe('TasksService', () => {
|
||||||
it('タスク一覧を取得できる(admin)', async () => {
|
it('タスク一覧を取得できる(admin)', async () => {
|
||||||
@ -588,20 +589,32 @@ describe('TasksService', () => {
|
|||||||
|
|
||||||
describe('DBテスト', () => {
|
describe('DBテスト', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -779,20 +792,32 @@ describe('TasksService', () => {
|
|||||||
|
|
||||||
describe('changeCheckoutPermission', () => {
|
describe('changeCheckoutPermission', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1409,20 +1434,32 @@ describe('changeCheckoutPermission', () => {
|
|||||||
|
|
||||||
describe('checkout', () => {
|
describe('checkout', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1609,7 +1646,6 @@ describe('checkout', () => {
|
|||||||
account_id: accountId,
|
account_id: accountId,
|
||||||
external_id: 'typist-user-external-id',
|
external_id: 'typist-user-external-id',
|
||||||
role: 'typist',
|
role: 'typist',
|
||||||
author_id: 'MY_AUTHOR_ID',
|
|
||||||
});
|
});
|
||||||
const { id: authorUserId } = await makeTestUser(source, {
|
const { id: authorUserId } = await makeTestUser(source, {
|
||||||
account_id: accountId,
|
account_id: accountId,
|
||||||
@ -1656,7 +1692,6 @@ describe('checkout', () => {
|
|||||||
account_id: accountId,
|
account_id: accountId,
|
||||||
external_id: 'typist-user-external-id',
|
external_id: 'typist-user-external-id',
|
||||||
role: 'typist',
|
role: 'typist',
|
||||||
author_id: 'MY_AUTHOR_ID',
|
|
||||||
});
|
});
|
||||||
const { id: authorUserId } = await makeTestUser(source, {
|
const { id: authorUserId } = await makeTestUser(source, {
|
||||||
account_id: accountId,
|
account_id: accountId,
|
||||||
@ -1993,20 +2028,32 @@ describe('checkout', () => {
|
|||||||
|
|
||||||
describe('checkin', () => {
|
describe('checkin', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2196,20 +2243,32 @@ describe('checkin', () => {
|
|||||||
|
|
||||||
describe('suspend', () => {
|
describe('suspend', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2395,20 +2454,32 @@ describe('suspend', () => {
|
|||||||
|
|
||||||
describe('cancel', () => {
|
describe('cancel', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3011,20 +3082,32 @@ describe('cancel', () => {
|
|||||||
|
|
||||||
describe('backup', () => {
|
describe('backup', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3305,20 +3388,32 @@ describe('backup', () => {
|
|||||||
|
|
||||||
describe('getNextTask', () => {
|
describe('getNextTask', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ export const makeTaskTestingModuleWithNotificaiton = async (
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
AuthModule,
|
AuthModule,
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('TemplatesController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -7,24 +7,37 @@ import { makeContext } from '../../common/log';
|
|||||||
import { TemplateFilesRepositoryService } from '../../repositories/template_files/template_files.repository.service';
|
import { TemplateFilesRepositoryService } from '../../repositories/template_files/template_files.repository.service';
|
||||||
import { HttpException, HttpStatus } from '@nestjs/common';
|
import { HttpException, HttpStatus } from '@nestjs/common';
|
||||||
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('getTemplates', () => {
|
describe('getTemplates', () => {
|
||||||
let source: DataSource | undefined = undefined;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
source = undefined;
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('テンプレートファイル一覧を取得できる', async () => {
|
it('テンプレートファイル一覧を取得できる', async () => {
|
||||||
|
|||||||
@ -6,23 +6,36 @@ import { makeContext } from '../../common/log';
|
|||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { HttpException, HttpStatus } from '@nestjs/common';
|
import { HttpException, HttpStatus } from '@nestjs/common';
|
||||||
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('利用規約取得', () => {
|
describe('利用規約取得', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ export const makeUsersServiceMock = async (
|
|||||||
providers: [UsersService],
|
providers: [UsersService],
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -113,7 +113,7 @@ export const makeTestingModuleWithAdb2c = async (
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
AuthModule,
|
AuthModule,
|
||||||
|
|||||||
@ -13,7 +13,7 @@ describe('UsersController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { HttpException, HttpStatus } from '@nestjs/common';
|
import { HttpException, HttpStatus } from '@nestjs/common';
|
||||||
import { AccessToken } from '../../common/token';
|
|
||||||
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
||||||
import {
|
import {
|
||||||
makeDefaultAdB2cMockValue,
|
makeDefaultAdB2cMockValue,
|
||||||
@ -47,21 +46,36 @@ import {
|
|||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { createOptionItems, createWorktype } from '../accounts/test/utility';
|
import { createOptionItems, createWorktype } from '../accounts/test/utility';
|
||||||
import { createWorkflow, getWorkflows } from '../workflows/test/utility';
|
import { createWorkflow, getWorkflows } from '../workflows/test/utility';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('UsersService.confirmUser', () => {
|
describe('UsersService.confirmUser', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
type: 'mysql',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
host: 'test_mysql_db',
|
||||||
});
|
port: 3306,
|
||||||
return source.initialize();
|
username: 'user',
|
||||||
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
|
||||||
if (!source) return;
|
beforeEach(async () => {
|
||||||
await source.destroy();
|
if (source) {
|
||||||
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -420,20 +434,32 @@ describe('UsersService.confirmUserAndInitPassword', () => {
|
|||||||
|
|
||||||
describe('UsersService.createUser', () => {
|
describe('UsersService.createUser', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1365,20 +1391,32 @@ describe('UsersService.createUser', () => {
|
|||||||
|
|
||||||
describe('UsersService.getUsers', () => {
|
describe('UsersService.getUsers', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1389,6 +1427,16 @@ describe('UsersService.getUsers', () => {
|
|||||||
if (!module) fail();
|
if (!module) fail();
|
||||||
|
|
||||||
const { id: accountId } = await makeTestSimpleAccount(source);
|
const { id: accountId } = await makeTestSimpleAccount(source);
|
||||||
|
const { id: typistUserId } = await makeTestUser(source, {
|
||||||
|
account_id: accountId,
|
||||||
|
external_id: 'external_id2',
|
||||||
|
role: 'typist',
|
||||||
|
author_id: undefined,
|
||||||
|
auto_renew: true,
|
||||||
|
encryption: false,
|
||||||
|
encryption_password: undefined,
|
||||||
|
prompt: false,
|
||||||
|
});
|
||||||
const { external_id: externalId_author, id: authorUserId } =
|
const { external_id: externalId_author, id: authorUserId } =
|
||||||
await makeTestUser(source, {
|
await makeTestUser(source, {
|
||||||
account_id: accountId,
|
account_id: accountId,
|
||||||
@ -1401,17 +1449,6 @@ describe('UsersService.getUsers', () => {
|
|||||||
prompt: false,
|
prompt: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { id: typistUserId } = await makeTestUser(source, {
|
|
||||||
account_id: accountId,
|
|
||||||
external_id: 'external_id2',
|
|
||||||
role: 'typist',
|
|
||||||
author_id: undefined,
|
|
||||||
auto_renew: true,
|
|
||||||
encryption: false,
|
|
||||||
encryption_password: undefined,
|
|
||||||
prompt: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
await createUserGroup(source, accountId, 'group1', [typistUserId]);
|
await createUserGroup(source, accountId, 'group1', [typistUserId]);
|
||||||
|
|
||||||
const { id: noneUserId } = await makeTestUser(source, {
|
const { id: noneUserId } = await makeTestUser(source, {
|
||||||
@ -1843,20 +1880,32 @@ describe('UsersService.getSortCriteria', () => {
|
|||||||
|
|
||||||
describe('UsersService.updateUser', () => {
|
describe('UsersService.updateUser', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2427,20 +2476,32 @@ describe('UsersService.updateUser', () => {
|
|||||||
|
|
||||||
describe('UsersService.updateAcceptedVersion', () => {
|
describe('UsersService.updateAcceptedVersion', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2515,20 +2576,32 @@ describe('UsersService.updateAcceptedVersion', () => {
|
|||||||
describe('UsersService.getUserName', () => {
|
describe('UsersService.getUserName', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true,
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2557,20 +2630,32 @@ describe('UsersService.getUserName', () => {
|
|||||||
describe('UsersService.getRelations', () => {
|
describe('UsersService.getRelations', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true,
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2622,6 +2707,8 @@ describe('UsersService.getRelations', () => {
|
|||||||
// 作成したデータを確認
|
// 作成したデータを確認
|
||||||
{
|
{
|
||||||
const workflows = await getWorkflows(source, account.id);
|
const workflows = await getWorkflows(source, account.id);
|
||||||
|
workflows.sort((a, b) => a.id - b.id);
|
||||||
|
|
||||||
expect(workflows.length).toBe(4);
|
expect(workflows.length).toBe(4);
|
||||||
expect(workflows[0].worktype_id).toBe(worktype1.id);
|
expect(workflows[0].worktype_id).toBe(worktype1.id);
|
||||||
expect(workflows[0].author_id).toBe(user1);
|
expect(workflows[0].author_id).toBe(user1);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('WorkflowsController', () => {
|
|||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: ['.env.local', '.env'],
|
envFilePath: ['.env.test', '.env'],
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -19,23 +19,36 @@ import { overrideAdB2cService } from '../../common/test/overrides';
|
|||||||
import { WorkflowsRepositoryService } from '../../repositories/workflows/workflows.repository.service';
|
import { WorkflowsRepositoryService } from '../../repositories/workflows/workflows.repository.service';
|
||||||
import { HttpException, HttpStatus } from '@nestjs/common';
|
import { HttpException, HttpStatus } from '@nestjs/common';
|
||||||
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
import { makeErrorResponse } from '../../common/error/makeErrorResponse';
|
||||||
|
import { truncateAllTable } from '../../common/test/init';
|
||||||
|
|
||||||
describe('getWorkflows', () => {
|
describe('getWorkflows', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await(async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
beforeEach(async () => {
|
||||||
if (!source) return;
|
if (source) {
|
||||||
await source.destroy();
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -47,22 +60,23 @@ describe('getWorkflows', () => {
|
|||||||
const { account, admin } = await makeTestAccount(source, { tier: 5 });
|
const { account, admin } = await makeTestAccount(source, { tier: 5 });
|
||||||
const { id: authorId1 } = await makeTestUser(source, {
|
const { id: authorId1 } = await makeTestUser(source, {
|
||||||
external_id: 'author1',
|
external_id: 'author1',
|
||||||
author_id: 'AUTHOR1',
|
author_id: 'BBBBB',
|
||||||
account_id: account.id,
|
account_id: account.id,
|
||||||
role: USER_ROLES.AUTHOR,
|
role: USER_ROLES.AUTHOR,
|
||||||
});
|
});
|
||||||
const { id: authorId2 } = await makeTestUser(source, {
|
const { id: authorId2 } = await makeTestUser(source, {
|
||||||
external_id: 'author2',
|
external_id: 'author2',
|
||||||
author_id: 'AUTHOR2',
|
author_id: 'AAAAA',
|
||||||
account_id: account.id,
|
account_id: account.id,
|
||||||
role: USER_ROLES.AUTHOR,
|
role: USER_ROLES.AUTHOR,
|
||||||
});
|
});
|
||||||
const { id: authorId3 } = await makeTestUser(source, {
|
const { id: authorId3 } = await makeTestUser(source, {
|
||||||
external_id: 'author3',
|
external_id: 'author3',
|
||||||
author_id: 'AUTHOR3',
|
author_id: 'CCCCC',
|
||||||
account_id: account.id,
|
account_id: account.id,
|
||||||
role: USER_ROLES.AUTHOR,
|
role: USER_ROLES.AUTHOR,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { id: typistId, external_id: typistExternalId } = await makeTestUser(
|
const { id: typistId, external_id: typistExternalId } = await makeTestUser(
|
||||||
source,
|
source,
|
||||||
{
|
{
|
||||||
@ -79,6 +93,12 @@ describe('getWorkflows', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { id: worktypeId1 } = await createWorktype(
|
const { id: worktypeId1 } = await createWorktype(
|
||||||
|
source,
|
||||||
|
account.id,
|
||||||
|
'worktype2',
|
||||||
|
);
|
||||||
|
|
||||||
|
const { id: worktypeId2 } = await createWorktype(
|
||||||
source,
|
source,
|
||||||
account.id,
|
account.id,
|
||||||
'worktype1',
|
'worktype1',
|
||||||
@ -95,7 +115,7 @@ describe('getWorkflows', () => {
|
|||||||
source,
|
source,
|
||||||
account.id,
|
account.id,
|
||||||
authorId1,
|
authorId1,
|
||||||
worktypeId1,
|
worktypeId2,
|
||||||
templateId1,
|
templateId1,
|
||||||
);
|
);
|
||||||
const workflow2 = await createWorkflow(
|
const workflow2 = await createWorkflow(
|
||||||
@ -112,10 +132,18 @@ describe('getWorkflows', () => {
|
|||||||
worktypeId1,
|
worktypeId1,
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
|
const workflow4 = await createWorkflow(
|
||||||
|
source,
|
||||||
|
account.id,
|
||||||
|
authorId3,
|
||||||
|
worktypeId2,
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
|
||||||
await createWorkflowTypist(source, workflow1.id, typistId, undefined);
|
await createWorkflowTypist(source, workflow1.id, typistId, undefined);
|
||||||
await createWorkflowTypist(source, workflow2.id, undefined, userGroupId);
|
await createWorkflowTypist(source, workflow2.id, undefined, userGroupId);
|
||||||
await createWorkflowTypist(source, workflow3.id, undefined, userGroupId);
|
await createWorkflowTypist(source, workflow3.id, undefined, userGroupId);
|
||||||
|
await createWorkflowTypist(source, workflow4.id, undefined, userGroupId);
|
||||||
|
|
||||||
const service = module.get<WorkflowsService>(WorkflowsService);
|
const service = module.get<WorkflowsService>(WorkflowsService);
|
||||||
const context = makeContext(admin.external_id, 'requestId');
|
const context = makeContext(admin.external_id, 'requestId');
|
||||||
@ -123,10 +151,10 @@ describe('getWorkflows', () => {
|
|||||||
//作成したデータを確認
|
//作成したデータを確認
|
||||||
{
|
{
|
||||||
const workflows = await getWorkflows(source, account.id);
|
const workflows = await getWorkflows(source, account.id);
|
||||||
expect(workflows.length).toBe(3);
|
expect(workflows.length).toBe(4);
|
||||||
expect(workflows[0].id).toBe(workflow1.id);
|
expect(workflows[0].id).toBe(workflow1.id);
|
||||||
expect(workflows[0].author_id).toBe(authorId1);
|
expect(workflows[0].author_id).toBe(authorId1);
|
||||||
expect(workflows[0].worktype_id).toBe(worktypeId1);
|
expect(workflows[0].worktype_id).toBe(worktypeId2);
|
||||||
expect(workflows[0].template_id).toBe(templateId1);
|
expect(workflows[0].template_id).toBe(templateId1);
|
||||||
|
|
||||||
expect(workflows[1].id).toBe(workflow2.id);
|
expect(workflows[1].id).toBe(workflow2.id);
|
||||||
@ -138,6 +166,11 @@ describe('getWorkflows', () => {
|
|||||||
expect(workflows[2].author_id).toBe(authorId3);
|
expect(workflows[2].author_id).toBe(authorId3);
|
||||||
expect(workflows[2].worktype_id).toBe(worktypeId1);
|
expect(workflows[2].worktype_id).toBe(worktypeId1);
|
||||||
expect(workflows[2].template_id).toBe(null);
|
expect(workflows[2].template_id).toBe(null);
|
||||||
|
|
||||||
|
expect(workflows[3].id).toBe(workflow4.id);
|
||||||
|
expect(workflows[3].author_id).toBe(authorId3);
|
||||||
|
expect(workflows[3].worktype_id).toBe(worktypeId2);
|
||||||
|
expect(workflows[3].template_id).toBe(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideAdB2cService(service, {
|
overrideAdB2cService(service, {
|
||||||
@ -148,37 +181,48 @@ describe('getWorkflows', () => {
|
|||||||
|
|
||||||
//実行結果を確認
|
//実行結果を確認
|
||||||
{
|
{
|
||||||
expect(resWorkflows.length).toBe(3);
|
expect(resWorkflows.length).toBe(4);
|
||||||
expect(resWorkflows[0].id).toBe(workflow1.id);
|
|
||||||
expect(resWorkflows[0].author.id).toBe(authorId1);
|
expect(resWorkflows[0].id).toBe(workflow2.id);
|
||||||
expect(resWorkflows[0].author.authorId).toBe('AUTHOR1');
|
expect(resWorkflows[0].author.id).toBe(authorId2);
|
||||||
expect(resWorkflows[0].worktype?.id).toBe(worktypeId1);
|
expect(resWorkflows[0].author.authorId).toBe('AAAAA');
|
||||||
expect(resWorkflows[0].worktype?.worktypeId).toBe('worktype1');
|
expect(resWorkflows[0].worktype).toBe(undefined);
|
||||||
expect(resWorkflows[0].template?.id).toBe(templateId1);
|
expect(resWorkflows[0].template?.id).toBe(templateId1);
|
||||||
expect(resWorkflows[0].template?.fileName).toBe('fileName1');
|
expect(resWorkflows[0].template?.fileName).toBe('fileName1');
|
||||||
expect(resWorkflows[0].typists.length).toBe(1);
|
expect(resWorkflows[0].typists.length).toBe(1);
|
||||||
expect(resWorkflows[0].typists[0].typistUserId).toBe(typistId);
|
expect(resWorkflows[0].typists[0].typistGroupId).toBe(userGroupId);
|
||||||
expect(resWorkflows[0].typists[0].typistName).toBe('typist1');
|
expect(resWorkflows[0].typists[0].typistName).toBe('group1');
|
||||||
|
|
||||||
expect(resWorkflows[1].id).toBe(workflow2.id);
|
expect(resWorkflows[1].id).toBe(workflow1.id);
|
||||||
expect(resWorkflows[1].author.id).toBe(authorId2);
|
expect(resWorkflows[1].author.id).toBe(authorId1);
|
||||||
expect(resWorkflows[1].author.authorId).toBe('AUTHOR2');
|
expect(resWorkflows[1].author.authorId).toBe('BBBBB');
|
||||||
expect(resWorkflows[1].worktype).toBe(undefined);
|
expect(resWorkflows[1].worktype?.id).toBe(worktypeId2);
|
||||||
|
expect(resWorkflows[1].worktype?.worktypeId).toBe('worktype1');
|
||||||
expect(resWorkflows[1].template?.id).toBe(templateId1);
|
expect(resWorkflows[1].template?.id).toBe(templateId1);
|
||||||
expect(resWorkflows[1].template?.fileName).toBe('fileName1');
|
expect(resWorkflows[1].template?.fileName).toBe('fileName1');
|
||||||
expect(resWorkflows[1].typists.length).toBe(1);
|
expect(resWorkflows[1].typists.length).toBe(1);
|
||||||
expect(resWorkflows[1].typists[0].typistGroupId).toBe(userGroupId);
|
expect(resWorkflows[1].typists[0].typistUserId).toBe(typistId);
|
||||||
expect(resWorkflows[1].typists[0].typistName).toBe('group1');
|
expect(resWorkflows[1].typists[0].typistName).toBe('typist1');
|
||||||
|
|
||||||
expect(resWorkflows[2].id).toBe(workflow3.id);
|
expect(resWorkflows[2].id).toBe(workflow4.id);
|
||||||
expect(resWorkflows[2].author.id).toBe(authorId3);
|
expect(resWorkflows[2].author.id).toBe(authorId3);
|
||||||
expect(resWorkflows[2].author.authorId).toBe('AUTHOR3');
|
expect(resWorkflows[2].author.authorId).toBe('CCCCC');
|
||||||
expect(resWorkflows[2].worktype?.id).toBe(worktypeId1);
|
expect(resWorkflows[2].worktype?.id).toBe(worktypeId2);
|
||||||
expect(resWorkflows[2].worktype?.worktypeId).toBe('worktype1');
|
expect(resWorkflows[2].worktype?.worktypeId).toBe('worktype1');
|
||||||
expect(resWorkflows[2].template).toBe(undefined);
|
expect(resWorkflows[2].template).toBe(undefined);
|
||||||
expect(resWorkflows[2].typists.length).toBe(1);
|
expect(resWorkflows[2].typists.length).toBe(1);
|
||||||
expect(resWorkflows[2].typists[0].typistGroupId).toBe(userGroupId);
|
expect(resWorkflows[2].typists[0].typistGroupId).toBe(userGroupId);
|
||||||
expect(resWorkflows[2].typists[0].typistName).toBe('group1');
|
expect(resWorkflows[2].typists[0].typistName).toBe('group1');
|
||||||
|
|
||||||
|
expect(resWorkflows[3].id).toBe(workflow3.id);
|
||||||
|
expect(resWorkflows[3].author.id).toBe(authorId3);
|
||||||
|
expect(resWorkflows[3].author.authorId).toBe('CCCCC');
|
||||||
|
expect(resWorkflows[3].worktype?.id).toBe(worktypeId1);
|
||||||
|
expect(resWorkflows[3].worktype?.worktypeId).toBe('worktype2');
|
||||||
|
expect(resWorkflows[3].template).toBe(undefined);
|
||||||
|
expect(resWorkflows[3].typists.length).toBe(1);
|
||||||
|
expect(resWorkflows[3].typists[0].typistGroupId).toBe(userGroupId);
|
||||||
|
expect(resWorkflows[3].typists[0].typistName).toBe('group1');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -209,7 +253,7 @@ describe('getWorkflows', () => {
|
|||||||
const module = await makeTestingModule(source);
|
const module = await makeTestingModule(source);
|
||||||
if (!module) fail();
|
if (!module) fail();
|
||||||
// 第五階層のアカウント作成
|
// 第五階層のアカウント作成
|
||||||
const { account, admin } = await makeTestAccount(source, { tier: 5 });
|
const { admin } = await makeTestAccount(source, { tier: 5 });
|
||||||
|
|
||||||
const service = module.get<WorkflowsService>(WorkflowsService);
|
const service = module.get<WorkflowsService>(WorkflowsService);
|
||||||
const context = makeContext(admin.external_id, 'requestId');
|
const context = makeContext(admin.external_id, 'requestId');
|
||||||
@ -236,22 +280,34 @@ describe('getWorkflows', () => {
|
|||||||
|
|
||||||
describe('createWorkflows', () => {
|
describe('createWorkflows', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
});
|
database: 'odms',
|
||||||
afterEach(async () => {
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
if (!source) return;
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
await source.destroy();
|
});
|
||||||
source = null;
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
if (source) {
|
||||||
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
|
source = null;
|
||||||
|
});
|
||||||
it('アカウント内にWorkflowを作成できる(WorktypeIDあり、テンプレートファイルあり)', async () => {
|
it('アカウント内にWorkflowを作成できる(WorktypeIDあり、テンプレートファイルあり)', async () => {
|
||||||
if (!source) fail();
|
if (!source) fail();
|
||||||
const module = await makeTestingModule(source);
|
const module = await makeTestingModule(source);
|
||||||
@ -575,6 +631,7 @@ describe('createWorkflows', () => {
|
|||||||
//実行結果を確認
|
//実行結果を確認
|
||||||
{
|
{
|
||||||
const workflows = await getWorkflows(source, account.id);
|
const workflows = await getWorkflows(source, account.id);
|
||||||
|
workflows.sort((a, b) => a.id - b.id);
|
||||||
expect(workflows.length).toBe(2);
|
expect(workflows.length).toBe(2);
|
||||||
expect(workflows[1].account_id).toBe(account.id);
|
expect(workflows[1].account_id).toBe(account.id);
|
||||||
expect(workflows[1].author_id).toBe(authorId);
|
expect(workflows[1].author_id).toBe(authorId);
|
||||||
@ -1162,19 +1219,32 @@ describe('createWorkflows', () => {
|
|||||||
|
|
||||||
describe('updateWorkflow', () => {
|
describe('updateWorkflow', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
|
||||||
if (!source) return;
|
beforeEach(async () => {
|
||||||
await source.destroy();
|
if (source) {
|
||||||
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1592,6 +1662,7 @@ describe('updateWorkflow', () => {
|
|||||||
//作成したデータを確認
|
//作成したデータを確認
|
||||||
{
|
{
|
||||||
const workflows = await getWorkflows(source, account.id);
|
const workflows = await getWorkflows(source, account.id);
|
||||||
|
workflows.sort((a, b) => a.id - b.id);
|
||||||
const workflowTypists = await getAllWorkflowTypists(source);
|
const workflowTypists = await getAllWorkflowTypists(source);
|
||||||
expect(workflows.length).toBe(2);
|
expect(workflows.length).toBe(2);
|
||||||
expect(workflows[0].id).toBe(preWorkflow1.id);
|
expect(workflows[0].id).toBe(preWorkflow1.id);
|
||||||
@ -1627,6 +1698,7 @@ describe('updateWorkflow', () => {
|
|||||||
//実行結果を確認
|
//実行結果を確認
|
||||||
{
|
{
|
||||||
const workflows = await getWorkflows(source, account.id);
|
const workflows = await getWorkflows(source, account.id);
|
||||||
|
workflows.sort((a, b) => a.id - b.id);
|
||||||
expect(workflows.length).toBe(2);
|
expect(workflows.length).toBe(2);
|
||||||
expect(workflows[1].account_id).toBe(account.id);
|
expect(workflows[1].account_id).toBe(account.id);
|
||||||
expect(workflows[1].author_id).toBe(authorId2);
|
expect(workflows[1].author_id).toBe(authorId2);
|
||||||
@ -2349,19 +2421,32 @@ describe('updateWorkflow', () => {
|
|||||||
|
|
||||||
describe('deleteWorkflows', () => {
|
describe('deleteWorkflows', () => {
|
||||||
let source: DataSource | null = null;
|
let source: DataSource | null = null;
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
source = new DataSource({
|
if (source == null) {
|
||||||
type: 'sqlite',
|
source = await (async () => {
|
||||||
database: ':memory:',
|
const s = new DataSource({
|
||||||
logging: false,
|
type: 'mysql',
|
||||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
host: 'test_mysql_db',
|
||||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
port: 3306,
|
||||||
});
|
username: 'user',
|
||||||
return source.initialize();
|
password: 'password',
|
||||||
|
database: 'odms',
|
||||||
|
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||||
|
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||||
|
});
|
||||||
|
return await s.initialize();
|
||||||
|
})();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
|
||||||
if (!source) return;
|
beforeEach(async () => {
|
||||||
await source.destroy();
|
if (source) {
|
||||||
|
await truncateAllTable(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await source?.destroy();
|
||||||
source = null;
|
source = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import {
|
|||||||
TIERS,
|
TIERS,
|
||||||
TRIAL_LICENSE_ISSUE_NUM,
|
TRIAL_LICENSE_ISSUE_NUM,
|
||||||
USER_ROLES,
|
USER_ROLES,
|
||||||
|
USER_ROLE_ORDERS,
|
||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
import { License } from '../licenses/entity/license.entity';
|
import { License } from '../licenses/entity/license.entity';
|
||||||
import { NewTrialLicenseExpirationDate } from '../../features/licenses/types/types';
|
import { NewTrialLicenseExpirationDate } from '../../features/licenses/types/types';
|
||||||
@ -496,10 +497,23 @@ export class UsersRepositoryService {
|
|||||||
license: true,
|
license: true,
|
||||||
},
|
},
|
||||||
where: { account_id: accountId },
|
where: { account_id: accountId },
|
||||||
|
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
return dbUsers;
|
// RoleのAuthor、Typist、Noneの順に並び替える
|
||||||
|
const roleSortedUsers = dbUsers.sort((a, b) => {
|
||||||
|
// Roleが同じ場合はIDの昇順で並び替える
|
||||||
|
if (a.role === b.role) {
|
||||||
|
return a.id - b.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
USER_ROLE_ORDERS.indexOf(a.role) - USER_ROLE_ORDERS.indexOf(b.role)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return roleSortedUsers;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,12 @@ export class WorkflowsRepositoryService {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
id: 'ASC',
|
author: {
|
||||||
|
author_id: 'ASC',
|
||||||
|
},
|
||||||
|
worktype: {
|
||||||
|
custom_worktype_id: 'ASC',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user