diff --git a/dictation_server/src/features/tasks/tasks.service.spec.ts b/dictation_server/src/features/tasks/tasks.service.spec.ts index 1531077..97f4ee2 100644 --- a/dictation_server/src/features/tasks/tasks.service.spec.ts +++ b/dictation_server/src/features/tasks/tasks.service.spec.ts @@ -946,6 +946,72 @@ describe('TasksService', () => { expect(task.jobNumber).toEqual('00000001'); } }); + it('[Admin] Taskが100件であっても取得できる', async () => { + const notificationhubServiceMockValue = + makeDefaultNotificationhubServiceMockValue(); + if (!source) fail(); + const module = await makeTaskTestingModuleWithNotificaiton( + source, + notificationhubServiceMockValue, + ); + if (!module) fail(); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'none', + }); + const { id: authorUserId, author_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + author_id: 'MY_AUTHOR_ID', + role: 'author', + }); + + const service = module.get(TasksService); + for (let i = 0; i < 100; i++) { + await createTask( + source, + accountId, + authorUserId, + author_id ?? '', + `WORKTYPE${i + 1}`, + '01', + // 00000001 ~ 00000100 + `000000${String(i + 1).padStart(2, '0')}`, + 'Uploaded', + ); + } + const offset = 0; + const limit = 100; + const status = ['Uploaded', 'Backup']; + const paramName = 'WORK_TYPE'; + const direction = 'DESC'; + + const { tasks, total } = await service.getTasks( + makeContext('trackingId', 'requestId'), + external_id, + [ADMIN_ROLES.ADMIN, USER_ROLES.NONE], + offset, + limit, + status, + paramName, + direction, + ); + expect(tasks.length).toEqual(100); + expect(total).toEqual(100); + // ソート条件がWORK_TYPEのため、WORK_TYPEが降順になっていることを確認 + expect(tasks[0].workType).toEqual('WORKTYPE99'); + expect(tasks[99].workType).toEqual('WORKTYPE1'); + expect(tasks[0].optionItemList).toEqual( + Array.from({ length: 10 }).map((_, i) => { + return { + optionItemLabel: `label${i}:audio_file_id${tasks[0].audioFileId}`, + optionItemValue: `value${i}:audio_file_id${tasks[0].audioFileId}`, + }; + }), + ); + }); }); }); diff --git a/dictation_server/src/features/tasks/tasks.service.ts b/dictation_server/src/features/tasks/tasks.service.ts index 898a8f9..8ddf007 100644 --- a/dictation_server/src/features/tasks/tasks.service.ts +++ b/dictation_server/src/features/tasks/tasks.service.ts @@ -435,12 +435,14 @@ export class TasksService { `author_id not found. audioFileId: ${audioFileId}. account_id: ${user.account_id}`, ); } - const { external_id: authorExternalId, notification: authorNotification } = - await this.usersRepository.findUserByAuthorId( - context, - task.file.author_id, - user.account_id, - ); + const { + external_id: authorExternalId, + notification: authorNotification, + } = await this.usersRepository.findUserByAuthorId( + context, + task.file.author_id, + user.account_id, + ); // プライマリ管理者を取得 const { external_id: primaryAdminExternalId } = diff --git a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts index ac9a5df..cd3edc4 100644 --- a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts +++ b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts @@ -903,7 +903,7 @@ export class SendGridService { // メールを送信する await this.sendMail( context, - [authorEmail, typistEmail].filter((x): x is string => x !== null), // authorEmailがnullの場合は除外する + [authorEmail, typistEmail].filter((x): x is string => x !== null), // authorEmailがnullの場合は除外する [], this.mailFrom, subject,