feat: per user featured notes

This commit is contained in:
syuilo 2023-10-06 18:30:08 +09:00
parent adf9d9c969
commit a5b6e807bb
11 changed files with 116 additions and 11 deletions

View file

@ -32,7 +32,7 @@ export const paramDef = {
type: 'object',
properties: {
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
offset: { type: 'integer', default: 0 },
untilId: { type: 'string', format: 'misskey:id' },
channelId: { type: 'string', nullable: true, format: 'misskey:id' },
},
required: [],
@ -69,7 +69,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
noteIds.sort((a, b) => a > b ? -1 : 1);
noteIds.slice(ps.offset, ps.offset + ps.limit);
if (ps.untilId) {
noteIds = noteIds.filter(id => id < ps.untilId!);
}
noteIds = noteIds.slice(0, ps.limit);
const query = this.notesRepository.createQueryBuilder('note')
.where('note.id IN (:...noteIds)', { noteIds: noteIds })