Merged PR 693: [テストFB対応]Workflow画面でのソート機能

## 概要
[Task3503: テスト対応](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3503)

- workflowsのソート条件を変更
  - AuthorIDの昇順
  - AuthorIDが同じ場合は、WorktypeIDの昇順

## レビューポイント
- 修正内容の認識があっているか

## 動作確認状況
- ローカルで確認

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
saito.k 2024-01-18 06:28:28 +00:00
parent 1ad3cb70c6
commit 3ac1218a6b
2 changed files with 57 additions and 23 deletions

View File

@ -47,22 +47,23 @@ describe('getWorkflows', () => {
const { account, admin } = await makeTestAccount(source, { tier: 5 });
const { id: authorId1 } = await makeTestUser(source, {
external_id: 'author1',
author_id: 'AUTHOR1',
author_id: 'BBBBB',
account_id: account.id,
role: USER_ROLES.AUTHOR,
});
const { id: authorId2 } = await makeTestUser(source, {
external_id: 'author2',
author_id: 'AUTHOR2',
author_id: 'AAAAA',
account_id: account.id,
role: USER_ROLES.AUTHOR,
});
const { id: authorId3 } = await makeTestUser(source, {
external_id: 'author3',
author_id: 'AUTHOR3',
author_id: 'CCCCC',
account_id: account.id,
role: USER_ROLES.AUTHOR,
});
const { id: typistId, external_id: typistExternalId } = await makeTestUser(
source,
{
@ -84,6 +85,12 @@ describe('getWorkflows', () => {
'worktype1',
);
const { id: worktypeId2 } = await createWorktype(
source,
account.id,
'worktype2',
);
const { id: templateId1 } = await createTemplateFile(
source,
account.id,
@ -106,6 +113,13 @@ describe('getWorkflows', () => {
templateId1,
);
const workflow3 = await createWorkflow(
source,
account.id,
authorId3,
worktypeId2,
undefined,
);
const workflow4 = await createWorkflow(
source,
account.id,
authorId3,
@ -116,6 +130,7 @@ describe('getWorkflows', () => {
await createWorkflowTypist(source, workflow1.id, typistId, undefined);
await createWorkflowTypist(source, workflow2.id, undefined, userGroupId);
await createWorkflowTypist(source, workflow3.id, undefined, userGroupId);
await createWorkflowTypist(source, workflow4.id, undefined, userGroupId);
const service = module.get<WorkflowsService>(WorkflowsService);
const context = makeContext(admin.external_id, 'requestId');
@ -123,7 +138,7 @@ describe('getWorkflows', () => {
//作成したデータを確認
{
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].author_id).toBe(authorId1);
expect(workflows[0].worktype_id).toBe(worktypeId1);
@ -136,8 +151,13 @@ describe('getWorkflows', () => {
expect(workflows[2].id).toBe(workflow3.id);
expect(workflows[2].author_id).toBe(authorId3);
expect(workflows[2].worktype_id).toBe(worktypeId1);
expect(workflows[2].worktype_id).toBe(worktypeId2);
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(worktypeId1);
expect(workflows[3].template_id).toBe(null);
}
overrideAdB2cService(service, {
@ -148,37 +168,48 @@ describe('getWorkflows', () => {
//実行結果を確認
{
expect(resWorkflows.length).toBe(3);
expect(resWorkflows[0].id).toBe(workflow1.id);
expect(resWorkflows[0].author.id).toBe(authorId1);
expect(resWorkflows[0].author.authorId).toBe('AUTHOR1');
expect(resWorkflows[0].worktype?.id).toBe(worktypeId1);
expect(resWorkflows[0].worktype?.worktypeId).toBe('worktype1');
expect(resWorkflows.length).toBe(4);
expect(resWorkflows[0].id).toBe(workflow2.id);
expect(resWorkflows[0].author.id).toBe(authorId2);
expect(resWorkflows[0].author.authorId).toBe('AAAAA');
expect(resWorkflows[0].worktype).toBe(undefined);
expect(resWorkflows[0].template?.id).toBe(templateId1);
expect(resWorkflows[0].template?.fileName).toBe('fileName1');
expect(resWorkflows[0].typists.length).toBe(1);
expect(resWorkflows[0].typists[0].typistUserId).toBe(typistId);
expect(resWorkflows[0].typists[0].typistName).toBe('typist1');
expect(resWorkflows[0].typists[0].typistGroupId).toBe(userGroupId);
expect(resWorkflows[0].typists[0].typistName).toBe('group1');
expect(resWorkflows[1].id).toBe(workflow2.id);
expect(resWorkflows[1].author.id).toBe(authorId2);
expect(resWorkflows[1].author.authorId).toBe('AUTHOR2');
expect(resWorkflows[1].worktype).toBe(undefined);
expect(resWorkflows[1].id).toBe(workflow1.id);
expect(resWorkflows[1].author.id).toBe(authorId1);
expect(resWorkflows[1].author.authorId).toBe('BBBBB');
expect(resWorkflows[1].worktype?.id).toBe(worktypeId1);
expect(resWorkflows[1].worktype?.worktypeId).toBe('worktype1');
expect(resWorkflows[1].template?.id).toBe(templateId1);
expect(resWorkflows[1].template?.fileName).toBe('fileName1');
expect(resWorkflows[1].typists.length).toBe(1);
expect(resWorkflows[1].typists[0].typistGroupId).toBe(userGroupId);
expect(resWorkflows[1].typists[0].typistName).toBe('group1');
expect(resWorkflows[1].typists[0].typistUserId).toBe(typistId);
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.authorId).toBe('AUTHOR3');
expect(resWorkflows[2].author.authorId).toBe('CCCCC');
expect(resWorkflows[2].worktype?.id).toBe(worktypeId1);
expect(resWorkflows[2].worktype?.worktypeId).toBe('worktype1');
expect(resWorkflows[2].template).toBe(undefined);
expect(resWorkflows[2].typists.length).toBe(1);
expect(resWorkflows[2].typists[0].typistGroupId).toBe(userGroupId);
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(worktypeId2);
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 +240,7 @@ describe('getWorkflows', () => {
const module = await makeTestingModule(source);
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 context = makeContext(admin.external_id, 'requestId');

View File

@ -50,7 +50,10 @@ export class WorkflowsRepositoryService {
},
},
order: {
id: 'ASC',
author: {
author_id: 'ASC',
},
worktype_id: 'ASC',
},
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
});