Merged PR 478: POデモ修正対応
## 概要 [Task2821: POデモ修正対応](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2821) - リテラル修正 - 追加Popupのタイトル - AuthorIDの初期値 - ワークフロー追加・更新の重複チェックの条件指定を修正 - undefined,nullのままだと条件指定しないという挙動になるためIsNull()を使用 - 該当ケースをテストに追加 ## レビューポイント - 特になし ## UIの変更 - タスクのなか ## 動作確認状況 - ローカルで確認、develop環境で確認など ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
3af64fbf8e
commit
8e317f5aca
@ -109,7 +109,7 @@ export const AddWorkflowPopup: React.FC<AddWorkflowPopupProps> = (
|
||||
<div className={`${styles.modal} ${styles.isShow}`}>
|
||||
<div className={styles.modalBox}>
|
||||
<p className={styles.modalTitle}>
|
||||
{t(getTranslationID("worktypeIdSetting.label.addWorktypeId"))}
|
||||
{t(getTranslationID("workflowPage.label.addRoutingRule"))}
|
||||
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions */}
|
||||
<img
|
||||
src={close}
|
||||
|
||||
@ -370,7 +370,7 @@
|
||||
"editRule": "(de)Edit Rule",
|
||||
"selected": "Ausgewählter transkriptionist",
|
||||
"pool": "Transkriptionsliste",
|
||||
"selectAuthor": "(de)Select Author",
|
||||
"selectAuthor": "(de)Select Author ID",
|
||||
"selectWorktypeId": "(de)Select Worktype ID",
|
||||
"selectTemplate": "(de)Select Template"
|
||||
},
|
||||
@ -498,4 +498,4 @@
|
||||
"backToTopPageLink": "(de)Back to TOP Page"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@
|
||||
"editRule": "Edit Rule",
|
||||
"selected": "Selected Transcriptionist",
|
||||
"pool": "Transcription List",
|
||||
"selectAuthor": "Select Author",
|
||||
"selectAuthor": "Select Author ID",
|
||||
"selectWorktypeId": "Select Worktype ID",
|
||||
"selectTemplate": "Select Template"
|
||||
},
|
||||
@ -498,4 +498,4 @@
|
||||
"backToTopPageLink": "Back to TOP Page"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@
|
||||
"editRule": "(es)Edit Rule",
|
||||
"selected": "Transcriptor seleccionado",
|
||||
"pool": "Lista de transcriptor",
|
||||
"selectAuthor": "(es)Select Author",
|
||||
"selectAuthor": "(es)Select Author ID",
|
||||
"selectWorktypeId": "(es)Select Worktype ID",
|
||||
"selectTemplate": "(es)Select Template"
|
||||
},
|
||||
@ -498,4 +498,4 @@
|
||||
"backToTopPageLink": "(es)Back to TOP Page"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@
|
||||
"editRule": "(fr)Edit Rule",
|
||||
"selected": "Transcriptionniste sélectionné",
|
||||
"pool": "Liste de transcriptionniste",
|
||||
"selectAuthor": "(fr)Select Author",
|
||||
"selectAuthor": "(fr)Select Author ID",
|
||||
"selectWorktypeId": "(fr)Select Worktype ID",
|
||||
"selectTemplate": "(fr)Select Template"
|
||||
},
|
||||
@ -498,4 +498,4 @@
|
||||
"backToTopPageLink": "(fr)Back to TOP Page"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,6 +493,82 @@ describe('createWorkflows', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('アカウント内にWorkflowを作成できる(WorktypeIDなし、テンプレートファイルなし、同一AuthorIDのワークフローあり)', async () => {
|
||||
const module = await makeTestingModule(source);
|
||||
// 第五階層のアカウント作成
|
||||
const { account, admin } = await makeTestAccount(source, { tier: 5 });
|
||||
const { id: authorId } = await makeTestUser(source, {
|
||||
external_id: 'author1',
|
||||
author_id: 'AUTHOR1',
|
||||
account_id: account.id,
|
||||
role: USER_ROLES.AUTHOR,
|
||||
});
|
||||
const { id: typistId } = await makeTestUser(source, {
|
||||
external_id: 'typist1',
|
||||
account_id: account.id,
|
||||
role: USER_ROLES.TYPIST,
|
||||
});
|
||||
|
||||
const { id: worktypeId } = await createWorktype(
|
||||
source,
|
||||
account.id,
|
||||
'worktype1',
|
||||
);
|
||||
|
||||
//作成したデータを確認
|
||||
{
|
||||
const workflows = await getWorkflows(source, account.id);
|
||||
const workflowTypists = await getAllWorkflowTypists(source);
|
||||
expect(workflows.length).toBe(0);
|
||||
expect(workflowTypists.length).toBe(0);
|
||||
}
|
||||
|
||||
const service = module.get<WorkflowsService>(WorkflowsService);
|
||||
const context = makeContext(admin.external_id);
|
||||
|
||||
// 同一AuthorIDのワークフローを作成
|
||||
await service.createWorkflow(
|
||||
context,
|
||||
admin.external_id,
|
||||
authorId,
|
||||
worktypeId,
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
typistId: typistId,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
await service.createWorkflow(
|
||||
context,
|
||||
admin.external_id,
|
||||
authorId,
|
||||
undefined,
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
typistId: typistId,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
//実行結果を確認
|
||||
{
|
||||
const workflows = await getWorkflows(source, account.id);
|
||||
expect(workflows.length).toBe(2);
|
||||
expect(workflows[1].account_id).toBe(account.id);
|
||||
expect(workflows[1].author_id).toBe(authorId);
|
||||
expect(workflows[1].worktype_id).toBe(null);
|
||||
expect(workflows[1].template_id).toBe(null);
|
||||
|
||||
const workflowTypists = await getWorkflowTypists(source, workflows[1].id);
|
||||
expect(workflowTypists.length).toBe(1);
|
||||
expect(workflowTypists[0].typist_id).toBe(typistId);
|
||||
expect(workflowTypists[0].typist_group_id).toBe(null);
|
||||
}
|
||||
});
|
||||
|
||||
it('DBにAuthorが存在しない場合、400エラーとなること', async () => {
|
||||
const module = await makeTestingModule(source);
|
||||
// 第五階層のアカウント作成
|
||||
@ -1292,6 +1368,108 @@ describe('updateWorkflow', () => {
|
||||
expect(workflowTypists[0].typist_id).toBe(typistId2);
|
||||
}
|
||||
});
|
||||
|
||||
it('アカウント内にWorkflowを作成できる(WorktypeIDなし、テンプレートファイルなし、同一AuthorIDのワークフローあり)', async () => {
|
||||
const module = await makeTestingModule(source);
|
||||
// 第五階層のアカウント作成
|
||||
const { account, admin } = await makeTestAccount(source, { tier: 5 });
|
||||
const { id: authorId1 } = await makeTestUser(source, {
|
||||
external_id: 'author1',
|
||||
author_id: 'AUTHOR1',
|
||||
account_id: account.id,
|
||||
role: USER_ROLES.AUTHOR,
|
||||
});
|
||||
const { id: authorId2 } = await makeTestUser(source, {
|
||||
external_id: 'author2',
|
||||
author_id: 'AUTHOR2',
|
||||
account_id: account.id,
|
||||
role: USER_ROLES.AUTHOR,
|
||||
});
|
||||
const { id: typistId1 } = await makeTestUser(source, {
|
||||
external_id: 'typist1',
|
||||
account_id: account.id,
|
||||
role: USER_ROLES.TYPIST,
|
||||
});
|
||||
const { id: typistId2 } = await makeTestUser(source, {
|
||||
external_id: 'typist12',
|
||||
account_id: account.id,
|
||||
role: USER_ROLES.TYPIST,
|
||||
});
|
||||
const { id: worktypeId } = await createWorktype(
|
||||
source,
|
||||
account.id,
|
||||
'worktype1',
|
||||
);
|
||||
// 更新対象のワークフローを作成
|
||||
const preWorkflow1 = await createWorkflow(
|
||||
source,
|
||||
account.id,
|
||||
authorId1,
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
// 同一AuthorIDのワークフローを作成
|
||||
const preWorkflow2 = await createWorkflow(
|
||||
source,
|
||||
account.id,
|
||||
authorId2, // 更新するAuthorIDと同じ
|
||||
worktypeId,
|
||||
undefined,
|
||||
);
|
||||
|
||||
await createWorkflowTypist(source, preWorkflow1.id, typistId1);
|
||||
await createWorkflowTypist(source, preWorkflow2.id, typistId1);
|
||||
|
||||
//作成したデータを確認
|
||||
{
|
||||
const workflows = await getWorkflows(source, account.id);
|
||||
const workflowTypists = await getAllWorkflowTypists(source);
|
||||
expect(workflows.length).toBe(2);
|
||||
expect(workflows[0].id).toBe(preWorkflow1.id);
|
||||
expect(workflows[0].account_id).toBe(account.id);
|
||||
expect(workflows[0].author_id).toBe(authorId1);
|
||||
expect(workflows[0].worktype_id).toBe(null);
|
||||
expect(workflows[0].template_id).toBe(null);
|
||||
expect(workflows[1].id).toBe(preWorkflow2.id);
|
||||
expect(workflows[1].account_id).toBe(account.id);
|
||||
expect(workflows[1].author_id).toBe(authorId2);
|
||||
expect(workflows[1].worktype_id).toBe(worktypeId);
|
||||
expect(workflows[1].template_id).toBe(null);
|
||||
expect(workflowTypists.length).toBe(2);
|
||||
}
|
||||
|
||||
const service = module.get<WorkflowsService>(WorkflowsService);
|
||||
const context = makeContext(admin.external_id);
|
||||
|
||||
await service.updateWorkflow(
|
||||
context,
|
||||
admin.external_id,
|
||||
preWorkflow1.id,
|
||||
authorId2,
|
||||
undefined,
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
typistId: typistId2,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
//実行結果を確認
|
||||
{
|
||||
const workflows = await getWorkflows(source, account.id);
|
||||
expect(workflows.length).toBe(2);
|
||||
expect(workflows[1].account_id).toBe(account.id);
|
||||
expect(workflows[1].author_id).toBe(authorId2);
|
||||
expect(workflows[1].worktype_id).toBe(null);
|
||||
expect(workflows[1].template_id).toBe(null);
|
||||
|
||||
const workflowTypists = await getWorkflowTypists(source, workflows[1].id);
|
||||
expect(workflowTypists.length).toBe(1);
|
||||
expect(workflowTypists[0].typist_id).toBe(typistId2);
|
||||
}
|
||||
});
|
||||
|
||||
it('DBにWorkflowが存在しない場合、400エラーとなること', async () => {
|
||||
const module = await makeTestingModule(source);
|
||||
// 第五階層のアカウント作成
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { DataSource, In } from 'typeorm';
|
||||
import { DataSource, In, IsNull } from 'typeorm';
|
||||
import { Workflow } from './entity/workflow.entity';
|
||||
import { WorkflowTypist as DbWorkflowTypist } from './entity/workflow_typists.entity';
|
||||
import { User } from '../users/entity/user.entity';
|
||||
@ -131,7 +131,7 @@ export class WorkflowsRepositoryService {
|
||||
where: {
|
||||
account_id: accountId,
|
||||
author_id: authorId,
|
||||
worktype_id: worktypeId,
|
||||
worktype_id: worktypeId !== undefined ? worktypeId : IsNull(),
|
||||
},
|
||||
});
|
||||
if (workflow.length !== 0) {
|
||||
@ -267,7 +267,7 @@ export class WorkflowsRepositoryService {
|
||||
where: {
|
||||
account_id: accountId,
|
||||
author_id: authorId,
|
||||
worktype_id: worktypeId,
|
||||
worktype_id: worktypeId !== undefined ? worktypeId : IsNull(),
|
||||
},
|
||||
});
|
||||
if (duplicateWorkflow.length !== 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user