diff --git a/packages/backend/src/server/api/endpoints/notes/schedule/list.ts b/packages/backend/src/server/api/endpoints/notes/schedule/list.ts index 3b8c029983..166f3fa3bb 100644 --- a/packages/backend/src/server/api/endpoints/notes/schedule/list.ts +++ b/packages/backend/src/server/api/endpoints/notes/schedule/list.ts @@ -9,6 +9,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js'; import { DI } from '@/di-symbols.js'; import type { ScheduledNotesRepository } from '@/models/_.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; +import { QueryService } from '@/core/QueryService.js'; export const meta = { tags: ['notes'], @@ -57,6 +58,12 @@ export const meta = { } as const; export const paramDef = { + type: 'object', + properties: { + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + }, } as const; @Injectable() @@ -64,10 +71,15 @@ export default class extends Endpoint { // eslint- constructor( @Inject(DI.scheduledNotesRepository) private scheduledNotesRepository: ScheduledNotesRepository, + private userEntityService: UserEntityService, + private queryService: QueryService, ) { super(meta, paramDef, async (ps, me) => { - const scheduleNotes = await this.scheduledNotesRepository.findBy({ userId: me.id }); + const query = this.queryService.makePaginationQuery(this.scheduledNotesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId) + .andWhere('note.userId = :userId', { userId: me.id }); + + const scheduleNotes = await query.limit(ps.limit).getMany(); const user = await this.userEntityService.pack(me, me); const scheduleNotesPack: { id: string;