mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
More API tests, fixes
This commit is contained in:
parent
932fc3e4f5
commit
d05b077df1
10 changed files with 90 additions and 28 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { MatchedRoute } from "bun";
|
||||
import { Status } from "~database/entities/Status";
|
||||
import { Status, statusRelations } from "~database/entities/Status";
|
||||
import { User } from "~database/entities/User";
|
||||
import { applyConfig } from "@api";
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ export default async (
|
|||
},
|
||||
isReblog: exclude_reblogs ? true : undefined,
|
||||
},
|
||||
relations: ["account", "emojis", "announces", "likes", "object"],
|
||||
relations: statusRelations,
|
||||
order: {
|
||||
created_at: "DESC",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { applyConfig } from "@api";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { MatchedRoute } from "bun";
|
||||
import { Status } from "~database/entities/Status";
|
||||
import { Status, statusRelations } from "~database/entities/Status";
|
||||
import { User } from "~database/entities/User";
|
||||
import { APIRouteMeta } from "~types/api";
|
||||
|
||||
|
|
@ -32,8 +32,11 @@ export default async (
|
|||
|
||||
let foundStatus: Status | null;
|
||||
try {
|
||||
foundStatus = await Status.findOneBy({
|
||||
id,
|
||||
foundStatus = await Status.findOne({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
relations: statusRelations,
|
||||
});
|
||||
} catch (e) {
|
||||
return errorResponse("Invalid ID", 404);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { applyConfig } from "@api";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { MatchedRoute } from "bun";
|
||||
import { Status } from "~database/entities/Status";
|
||||
import { Status, statusRelations } from "~database/entities/Status";
|
||||
import { User } from "~database/entities/User";
|
||||
import { APIRouteMeta } from "~types/api";
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ export default async (
|
|||
where: {
|
||||
id,
|
||||
},
|
||||
relations: ["account", "object"],
|
||||
relations: statusRelations,
|
||||
});
|
||||
} catch (e) {
|
||||
return errorResponse("Invalid ID", 404);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { sanitize } from "isomorphic-dompurify";
|
|||
import { parse } from "marked";
|
||||
import { Application } from "~database/entities/Application";
|
||||
import { RawObject } from "~database/entities/RawObject";
|
||||
import { Status } from "~database/entities/Status";
|
||||
import { Status, statusRelations } from "~database/entities/Status";
|
||||
import { User } from "~database/entities/User";
|
||||
import { APIRouteMeta } from "~types/api";
|
||||
|
||||
|
|
@ -132,9 +132,7 @@ export default async (req: Request): Promise<Response> => {
|
|||
where: {
|
||||
id: in_reply_to_id,
|
||||
},
|
||||
relations: {
|
||||
account: true,
|
||||
},
|
||||
relations: statusRelations,
|
||||
});
|
||||
|
||||
replyUser = replyStatus?.account || null;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { applyConfig } from "@api";
|
|||
import { parseRequest } from "@request";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { FindManyOptions } from "typeorm";
|
||||
import { Status } from "~database/entities/Status";
|
||||
import { Status, statusRelations } from "~database/entities/Status";
|
||||
import { User } from "~database/entities/User";
|
||||
import { APIRouteMeta } from "~types/api";
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ export default async (req: Request): Promise<Response> => {
|
|||
created_at: "DESC",
|
||||
},
|
||||
take: limit,
|
||||
relations: ["object"],
|
||||
relations: statusRelations,
|
||||
};
|
||||
|
||||
if (max_id) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { applyConfig } from "@api";
|
|||
import { parseRequest } from "@request";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { FindManyOptions, IsNull, Not } from "typeorm";
|
||||
import { Status } from "~database/entities/Status";
|
||||
import { Status, statusRelations } from "~database/entities/Status";
|
||||
import { APIRouteMeta } from "~types/api";
|
||||
|
||||
export const meta: APIRouteMeta = applyConfig({
|
||||
|
|
@ -56,7 +56,7 @@ export default async (req: Request): Promise<Response> => {
|
|||
created_at: "DESC",
|
||||
},
|
||||
take: limit,
|
||||
relations: ["object"],
|
||||
relations: statusRelations,
|
||||
};
|
||||
|
||||
if (max_id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue