mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 05:57:32 -07:00
refactor: ♻️ correct params for notes/children+conversion
This commit is contained in:
parent
3255066fe4
commit
f4776712a3
2 changed files with 4 additions and 4 deletions
|
@ -1,4 +1,3 @@
|
||||||
import { Brackets } from "typeorm";
|
|
||||||
import { Notes } from "@/models/index.js";
|
import { Notes } from "@/models/index.js";
|
||||||
import define from "../../define.js";
|
import define from "../../define.js";
|
||||||
import { makePaginationQuery } from "../../common/make-pagination-query.js";
|
import { makePaginationQuery } from "../../common/make-pagination-query.js";
|
||||||
|
@ -23,13 +22,14 @@ export const meta = {
|
||||||
ref: "Note",
|
ref: "Note",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
noteId: { type: "string", format: "misskey:id" },
|
noteId: { type: "string", format: "misskey:id" },
|
||||||
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
||||||
|
depth: { type: "integer", minimum: 1, maximum: 100, default: 12},
|
||||||
sinceId: { type: "string", format: "misskey:id" },
|
sinceId: { type: "string", format: "misskey:id" },
|
||||||
untilId: { type: "string", format: "misskey:id" },
|
untilId: { type: "string", format: "misskey:id" },
|
||||||
},
|
},
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const conversation: Note[] = [];
|
const conversation: Note[] = [];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
async function get(id: any) {
|
async function get(id: string) {
|
||||||
i++;
|
i++;
|
||||||
const p = await getNote(id, user).catch((e) => {
|
const p = await getNote(id, user).catch((e) => {
|
||||||
if (e.id === "9725d0ce-ba28-4dde-95a7-2cbb2c15de24") return null;
|
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 (p == null) return;
|
||||||
|
|
||||||
if (i > ps.offset!) {
|
if (i > ps.offset) {
|
||||||
conversation.push(p);
|
conversation.push(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue