summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/notes/featured.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-06 18:30:08 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-06 18:30:08 +0900
commita5b6e807bb6aaf3212f88b4ec4f96c285a80e390 (patch)
treeb33b8a2810d19eea0fba105c0686526821900bae /packages/backend/src/server/api/endpoints/notes/featured.ts
parent2023.10.0-beta.4 (diff)
downloadsharkey-a5b6e807bb6aaf3212f88b4ec4f96c285a80e390.tar.gz
sharkey-a5b6e807bb6aaf3212f88b4ec4f96c285a80e390.tar.bz2
sharkey-a5b6e807bb6aaf3212f88b4ec4f96c285a80e390.zip
feat: per user featured notes
Diffstat (limited to 'packages/backend/src/server/api/endpoints/notes/featured.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/notes/featured.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts
index bf4ad1deb6..c456874309 100644
--- a/packages/backend/src/server/api/endpoints/notes/featured.ts
+++ b/packages/backend/src/server/api/endpoints/notes/featured.ts
@@ -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 })