From c467db2ea28add4ad64507d25b70c5aa97606227 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 14 Jul 2023 23:13:32 -0700 Subject: [PATCH] refactor: :recycle: correct params for notes/children+conversion --- packages/backend/src/server/api/endpoints/notes/children.ts | 4 ++-- .../backend/src/server/api/endpoints/notes/conversation.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index 9047fcce1d..dc536df62e 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -1,4 +1,3 @@ -import { Brackets } from "typeorm"; import { Notes } from "@/models/index.js"; import define from "../../define.js"; import { makePaginationQuery } from "../../common/make-pagination-query.js"; @@ -23,13 +22,14 @@ export const meta = { ref: "Note", }, }, -}; +} as const; export const paramDef = { type: "object", properties: { noteId: { type: "string", format: "misskey:id" }, limit: { type: "integer", minimum: 1, maximum: 100, default: 10 }, + depth: { type: "integer", minimum: 1, maximum: 100, default: 12}, sinceId: { type: "string", format: "misskey:id" }, untilId: { type: "string", format: "misskey:id" }, }, diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index 2e8f5ef73b..47c6727364 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -51,7 +51,7 @@ export default define(meta, paramDef, async (ps, user) => { const conversation: Note[] = []; let i = 0; - async function get(id: any) { + async function get(id: string) { i++; const p = await getNote(id, user).catch((e) => { if (e.id === "9725d0ce-ba28-4dde-95a7-2cbb2c15de24") return null; @@ -60,7 +60,7 @@ export default define(meta, paramDef, async (ps, user) => { if (p == null) return; - if (i > ps.offset!) { + if (i > ps.offset) { conversation.push(p); }