Merged PR 779: タスク一覧画面のOptionItemがソート条件によって表示順がおかしくなる
## 概要 [Task3787: タスク一覧画面のOptionItemがソート条件によって表示順がおかしくなる](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3787) - タスク一覧取得APIレスポンスにあるOptionItemの順番を固定する(idの昇順) - テスト修正 ## レビューポイント - 特になし ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
5a78a6668f
commit
0ab6488f58
@ -782,6 +782,103 @@ describe('TasksService', () => {
|
||||
expect(task.optionItemList).toEqual(audioOptionItems);
|
||||
}
|
||||
});
|
||||
|
||||
it('[Author] Authorは自分が作成者のTask一覧を取得できる(ソート条件がJob_number以外)', async () => {
|
||||
const notificationhubServiceMockValue =
|
||||
makeDefaultNotificationhubServiceMockValue();
|
||||
if (!source) fail();
|
||||
const module = await makeTaskTestingModuleWithNotificaiton(
|
||||
source,
|
||||
notificationhubServiceMockValue,
|
||||
);
|
||||
if (!module) fail();
|
||||
const { id: accountId } = await makeTestSimpleAccount(source);
|
||||
const { id: userId, external_id } = await makeTestUser(source, {
|
||||
account_id: accountId,
|
||||
external_id: 'userId',
|
||||
role: 'author',
|
||||
author_id: 'MY_AUTHOR_ID',
|
||||
});
|
||||
|
||||
//「バグ 3661: [FB対応]Option Itemにチェックを付けると真っ白な画面になる」の確認のため
|
||||
// audio_file_idをTaskIdと異なる値にするために、AudioFileを作成
|
||||
await createAudioFile(
|
||||
source,
|
||||
accountId,
|
||||
userId,
|
||||
'MY_AUTHOR_ID',
|
||||
'',
|
||||
'00',
|
||||
);
|
||||
|
||||
// Taskを作成
|
||||
await createTask(
|
||||
source,
|
||||
accountId,
|
||||
userId,
|
||||
'MY_AUTHOR_ID',
|
||||
'WORKTYPE1',
|
||||
'01',
|
||||
'00000001',
|
||||
'Uploaded',
|
||||
);
|
||||
await createTask(
|
||||
source,
|
||||
accountId,
|
||||
userId,
|
||||
'MY_AUTHOR_ID',
|
||||
'WORKTYPE2',
|
||||
'01',
|
||||
'00000002',
|
||||
'Uploaded',
|
||||
);
|
||||
|
||||
const service = module.get<TasksService>(TasksService);
|
||||
const offset = 0;
|
||||
const limit = 20;
|
||||
const status = ['Uploaded', 'Backup'];
|
||||
// バグ 3786: [FB対応]タスク一覧画面のOptionItemがソート条件によって表示順がおかしくなる の確認のため
|
||||
// Job_number以外のソート条件を指定
|
||||
const paramName = 'WORK_TYPE';
|
||||
const direction = 'DESC';
|
||||
|
||||
const { tasks, total } = await service.getTasks(
|
||||
makeContext('trackingId', 'requestId'),
|
||||
external_id,
|
||||
[USER_ROLES.AUTHOR],
|
||||
offset,
|
||||
limit,
|
||||
status,
|
||||
paramName,
|
||||
direction,
|
||||
);
|
||||
|
||||
expect(total).toEqual(2);
|
||||
{
|
||||
const task = tasks[0];
|
||||
expect(task.jobNumber).toEqual('00000002');
|
||||
// ソート条件がJob_number以外でもOptionItemがid順に取得されていることを確認
|
||||
const audioOptionItems = Array.from({ length: 10 }).map((_, i) => {
|
||||
return {
|
||||
optionItemLabel: `label${i}:audio_file_id${task.audioFileId}`,
|
||||
optionItemValue: `value${i}:audio_file_id${task.audioFileId}`,
|
||||
};
|
||||
});
|
||||
expect(task.optionItemList).toEqual(audioOptionItems);
|
||||
}
|
||||
{
|
||||
const task = tasks[1];
|
||||
expect(task.jobNumber).toEqual('00000001');
|
||||
// ソート条件がJob_number以外でもOptionItemがid順に取得されていることを確認
|
||||
const audioOptionItems = Array.from({ length: 10 }).map((_, i) => {
|
||||
return {
|
||||
optionItemLabel: `label${i}:audio_file_id${task.audioFileId}`,
|
||||
optionItemValue: `value${i}:audio_file_id${task.audioFileId}`,
|
||||
};
|
||||
});
|
||||
expect(task.optionItemList).toEqual(audioOptionItems);
|
||||
}
|
||||
});
|
||||
it('[Author] Authorは同一アカウントであっても自分以外のAuhtorのTaskは取得できない', async () => {
|
||||
const notificationhubServiceMockValue =
|
||||
makeDefaultNotificationhubServiceMockValue();
|
||||
|
||||
@ -1462,78 +1462,91 @@ const makeOrder = (
|
||||
priority: 'DESC',
|
||||
job_number: direction,
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'STATUS':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
status: direction,
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'TRANSCRIPTION_FINISHED_DATE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
finished_at: direction,
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'TRANSCRIPTION_STARTED_DATE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
started_at: direction,
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'AUTHOR_ID':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { author_id: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'ENCRYPTION':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { is_encrypted: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'FILE_LENGTH':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { duration: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'FILE_NAME':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { file_name: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'FILE_SIZE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { file_size: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'RECORDING_FINISHED_DATE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { finished_at: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'RECORDING_STARTED_DATE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { started_at: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'UPLOAD_DATE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { uploaded_at: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
case 'WORK_TYPE':
|
||||
return {
|
||||
priority: 'DESC',
|
||||
file: { work_type_id: direction },
|
||||
id: 'ASC',
|
||||
option_items: { id: 'ASC' },
|
||||
};
|
||||
default:
|
||||
// switchのcase漏れが発生した場合に型エラーになるようにする
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user