Merged PR 769: /users/relationsレスポンスのWorkTypeIDをID名の昇順にする
## 概要 [Task3783: /users/relationsレスポンスのWorkTypeIDをID名の昇順にする](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3783) - relationsAPIレスポンスのWorkTypeList内の順番を指定する - テスト修正 ## レビューポイント - 修正内容に不足はないか ## UIの変更 - Before/Afterのスクショなど - スクショ置き場 ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
d0628caa05
commit
5a78a6668f
@ -15,7 +15,7 @@ import { USER_ROLES } from '../../constants';
|
|||||||
@ValidatorConstraint({ name: 'IsAuthorId', async: false })
|
@ValidatorConstraint({ name: 'IsAuthorId', async: false })
|
||||||
export class IsAuthorId implements ValidatorConstraintInterface {
|
export class IsAuthorId implements ValidatorConstraintInterface {
|
||||||
validate(value: any, args: ValidationArguments) {
|
validate(value: any, args: ValidationArguments) {
|
||||||
const request = args.object as SignupRequest | PostUpdateUserRequest;
|
const request = args.object as SignupRequest | PostUpdateUserRequest;
|
||||||
// requestの存在チェック
|
// requestの存在チェック
|
||||||
if (!request) {
|
if (!request) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -170,7 +170,7 @@ describe('UsersService.confirmUser', () => {
|
|||||||
});
|
});
|
||||||
expect(_subject).toBe('Account Registered Notification [U-101]');
|
expect(_subject).toBe('Account Registered Notification [U-101]');
|
||||||
expect(_url).toBe('http://localhost:8081/');
|
expect(_url).toBe('http://localhost:8081/');
|
||||||
}, 600000);
|
});
|
||||||
|
|
||||||
it('トークンの形式が不正な場合、形式不正エラーとなる。', async () => {
|
it('トークンの形式が不正な場合、形式不正エラーとなる。', async () => {
|
||||||
if (!source) fail();
|
if (!source) fail();
|
||||||
@ -2735,17 +2735,21 @@ describe('UsersService.getRelations', () => {
|
|||||||
const worktype1 = await createWorktype(
|
const worktype1 = await createWorktype(
|
||||||
source,
|
source,
|
||||||
account.id,
|
account.id,
|
||||||
'worktype1',
|
'worktypeB',
|
||||||
undefined,
|
undefined,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
await createOptionItems(source, worktype1.id);
|
await createOptionItems(source, worktype1.id);
|
||||||
|
|
||||||
const worktype2 = await createWorktype(source, account.id, 'worktype2');
|
const worktype2 = await createWorktype(source, account.id, 'worktypeC');
|
||||||
await createOptionItems(source, worktype2.id);
|
await createOptionItems(source, worktype2.id);
|
||||||
|
|
||||||
|
const worktype3 = await createWorktype(source, account.id, 'worktypeA');
|
||||||
|
await createOptionItems(source, worktype3.id);
|
||||||
|
|
||||||
await createWorkflow(source, account.id, user1, worktype1.id);
|
await createWorkflow(source, account.id, user1, worktype1.id);
|
||||||
await createWorkflow(source, account.id, user1, worktype2.id);
|
await createWorkflow(source, account.id, user1, worktype2.id);
|
||||||
|
await createWorkflow(source, account.id, user1, worktype3.id);
|
||||||
await createWorkflow(source, account.id, user1);
|
await createWorkflow(source, account.id, user1);
|
||||||
await createWorkflow(source, account.id, user2, worktype1.id);
|
await createWorkflow(source, account.id, user2, worktype1.id);
|
||||||
|
|
||||||
@ -2754,15 +2758,17 @@ 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);
|
workflows.sort((a, b) => a.id - b.id);
|
||||||
|
|
||||||
expect(workflows.length).toBe(4);
|
expect(workflows.length).toBe(5);
|
||||||
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);
|
||||||
expect(workflows[1].worktype_id).toBe(worktype2.id);
|
expect(workflows[1].worktype_id).toBe(worktype2.id);
|
||||||
expect(workflows[1].author_id).toBe(user1);
|
expect(workflows[1].author_id).toBe(user1);
|
||||||
expect(workflows[2].worktype_id).toBe(null);
|
expect(workflows[2].worktype_id).toBe(worktype3.id);
|
||||||
expect(workflows[2].author_id).toBe(user1);
|
expect(workflows[2].author_id).toBe(user1);
|
||||||
expect(workflows[3].worktype_id).toBe(worktype1.id);
|
expect(workflows[3].worktype_id).toBe(null);
|
||||||
expect(workflows[3].author_id).toBe(user2);
|
expect(workflows[3].author_id).toBe(user1);
|
||||||
|
expect(workflows[4].worktype_id).toBe(worktype1.id);
|
||||||
|
expect(workflows[4].author_id).toBe(user2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = makeContext(external_id, 'requestId');
|
const context = makeContext(external_id, 'requestId');
|
||||||
@ -2778,14 +2784,17 @@ describe('UsersService.getRelations', () => {
|
|||||||
expect(relations.authorIdList[1]).toBe('AUTHOR_2');
|
expect(relations.authorIdList[1]).toBe('AUTHOR_2');
|
||||||
|
|
||||||
const workTypeList = relations.workTypeList;
|
const workTypeList = relations.workTypeList;
|
||||||
expect(relations.workTypeList.length).toBe(2);
|
expect(relations.workTypeList.length).toBe(3);
|
||||||
expect(workTypeList[0].workTypeId).toBe(worktype1.custom_worktype_id);
|
// Workflowの作成順ではなくcustom_worktype_idの昇順で取得するためWorkTypeListの先頭はworktype3
|
||||||
|
expect(workTypeList[0].workTypeId).toBe(worktype3.custom_worktype_id);
|
||||||
expect(workTypeList[0].optionItemList.length).toBe(10);
|
expect(workTypeList[0].optionItemList.length).toBe(10);
|
||||||
expect(workTypeList[0].optionItemList[0].label).toBe('');
|
expect(workTypeList[0].optionItemList[0].label).toBe('');
|
||||||
expect(workTypeList[0].optionItemList[0].initialValueType).toBe(2);
|
expect(workTypeList[0].optionItemList[0].initialValueType).toBe(2);
|
||||||
expect(workTypeList[0].optionItemList[0].defaultValue).toBe('');
|
expect(workTypeList[0].optionItemList[0].defaultValue).toBe('');
|
||||||
expect(workTypeList[1].workTypeId).toBe(worktype2.custom_worktype_id);
|
expect(workTypeList[1].workTypeId).toBe(worktype1.custom_worktype_id);
|
||||||
expect(workTypeList[1].optionItemList.length).toBe(10);
|
expect(workTypeList[1].optionItemList.length).toBe(10);
|
||||||
|
expect(workTypeList[2].workTypeId).toBe(worktype2.custom_worktype_id);
|
||||||
|
expect(workTypeList[2].optionItemList.length).toBe(10);
|
||||||
|
|
||||||
expect(relations.isEncrypted).toBe(true);
|
expect(relations.isEncrypted).toBe(true);
|
||||||
expect(relations.encryptionPassword).toBe('password');
|
expect(relations.encryptionPassword).toBe('password');
|
||||||
|
|||||||
@ -918,6 +918,14 @@ export class UsersRepositoryService {
|
|||||||
option_items: true,
|
option_items: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
order: {
|
||||||
|
worktype: {
|
||||||
|
custom_worktype_id: 'ASC',
|
||||||
|
option_items: {
|
||||||
|
id: 'ASC',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
comment: `${context.getTrackingId()}_${new Date().toUTCString()}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user