chore (backend): remove horrible API endpoints
This commit is contained in:
parent
20ca238b59
commit
945cc87dc7
5 changed files with 3 additions and 68 deletions
|
@ -8,6 +8,9 @@ Breaking changes are indicated by the :warning: icon.
|
|||
- `reply-mute/create`
|
||||
- `reply-mute/delete`
|
||||
- `reply-mute/list`
|
||||
- :warning: The following (horrible) endpoints are removed:
|
||||
- `admin/vacuum`
|
||||
- `reset-db`
|
||||
|
||||
## v20240228
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ import * as ep___admin_suspendUser from "./endpoints/admin/suspend-user.js";
|
|||
import * as ep___admin_unsilenceUser from "./endpoints/admin/unsilence-user.js";
|
||||
import * as ep___admin_unsuspendUser from "./endpoints/admin/unsuspend-user.js";
|
||||
import * as ep___admin_updateMeta from "./endpoints/admin/update-meta.js";
|
||||
import * as ep___admin_vacuum from "./endpoints/admin/vacuum.js";
|
||||
import * as ep___admin_deleteAccount from "./endpoints/admin/delete-account.js";
|
||||
import * as ep___admin_delete2fa from "./endpoints/admin/delete-2fa.js";
|
||||
import * as ep___admin_deletePasskeys from "./endpoints/admin/delete-passkeys.js";
|
||||
|
@ -290,7 +289,6 @@ import * as ep___patrons from "./endpoints/patrons.js";
|
|||
import * as ep___release from "./endpoints/release.js";
|
||||
import * as ep___promo_read from "./endpoints/promo/read.js";
|
||||
import * as ep___requestResetPassword from "./endpoints/request-reset-password.js";
|
||||
import * as ep___resetDb from "./endpoints/reset-db.js";
|
||||
import * as ep___resetPassword from "./endpoints/reset-password.js";
|
||||
import * as ep___serverInfo from "./endpoints/server-info.js";
|
||||
import * as ep___stats from "./endpoints/stats.js";
|
||||
|
@ -414,7 +412,6 @@ const eps = [
|
|||
["admin/unsilence-user", ep___admin_unsilenceUser],
|
||||
["admin/unsuspend-user", ep___admin_unsuspendUser],
|
||||
["admin/update-meta", ep___admin_updateMeta],
|
||||
["admin/vacuum", ep___admin_vacuum],
|
||||
["admin/delete-account", ep___admin_deleteAccount],
|
||||
["admin/delete-2fa", ep___admin_delete2fa],
|
||||
["admin/delete-passkeys", ep___admin_deletePasskeys],
|
||||
|
@ -641,7 +638,6 @@ const eps = [
|
|||
["release", ep___release],
|
||||
["promo/read", ep___promo_read],
|
||||
["request-reset-password", ep___requestResetPassword],
|
||||
["reset-db", ep___resetDb],
|
||||
["reset-password", ep___resetPassword],
|
||||
["server-info", ep___serverInfo],
|
||||
["stats", ep___stats],
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
import define from "@/server/api/define.js";
|
||||
import { insertModerationLog } from "@/services/insert-moderation-log.js";
|
||||
import { db } from "@/db/postgre.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["admin"],
|
||||
|
||||
requireCredential: true,
|
||||
requireModerator: true,
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: "object",
|
||||
properties: {
|
||||
full: { type: "boolean" },
|
||||
analyze: { type: "boolean" },
|
||||
},
|
||||
required: ["full", "analyze"],
|
||||
} as const;
|
||||
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
const params: string[] = [];
|
||||
|
||||
if (ps.full) {
|
||||
params.push("FULL");
|
||||
}
|
||||
|
||||
if (ps.analyze) {
|
||||
params.push("ANALYZE");
|
||||
}
|
||||
|
||||
db.query(`VACUUM ${params.join(" ")}`);
|
||||
|
||||
insertModerationLog(me, "vacuum", ps);
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
import { resetDb } from "@/db/postgre.js";
|
||||
import define from "@/server/api/define.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["non-productive"],
|
||||
|
||||
requireCredential: false,
|
||||
|
||||
description:
|
||||
"Only available when running with <code>NODE_ENV=testing</code>. Reset the database and flush Redis.",
|
||||
|
||||
errors: {},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: "object",
|
||||
properties: {},
|
||||
required: [],
|
||||
} as const;
|
||||
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if (process.env.NODE_ENV !== "test")
|
||||
throw new Error("NODE_ENV is not a test");
|
||||
|
||||
await resetDb();
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
});
|
|
@ -89,7 +89,6 @@ export type Endpoints = {
|
|||
"admin/unsilence-user": { req: TODO; res: TODO };
|
||||
"admin/unsuspend-user": { req: TODO; res: TODO };
|
||||
"admin/update-meta": { req: TODO; res: TODO };
|
||||
"admin/vacuum": { req: TODO; res: TODO };
|
||||
"admin/accounts/create": { req: TODO; res: TODO };
|
||||
"admin/ad/create": { req: TODO; res: TODO };
|
||||
"admin/ad/delete": { req: { id: Ad["id"] }; res: null };
|
||||
|
|
Loading…
Reference in a new issue