refactor(api): 🔥 Remove all useless route metadata objects

This commit is contained in:
Jesse Wierzbinski 2024-12-30 20:18:48 +01:00
parent a9ea5eb672
commit 4926d6ff5d
No known key found for this signature in database
137 changed files with 410 additions and 1830 deletions

View file

@ -10,7 +10,6 @@ import type {
Unfollow,
User,
} from "@versia/federation/types";
import type { RolePermissions } from "@versia/kit/tables";
import type { SocketAddress } from "bun";
import type { RouterRoute } from "hono/types";
import { z } from "zod";
@ -18,32 +17,6 @@ import type { AuthData } from "~/classes/functions/user";
import type { Config } from "~/packages/config-manager";
export type HttpVerb = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
export interface ApiRouteMetadata {
ratelimits: {
max: number;
duration: number;
};
route: string;
auth: {
required: boolean;
methodOverrides?: {
[Key in HttpVerb]?: boolean;
};
oauthPermissions?: string[];
};
challenge?: {
required: boolean;
methodOverrides?: {
[Key in HttpVerb]?: boolean;
};
};
permissions?: {
required: RolePermissions[];
methodOverrides?: {
[Key in HttpVerb]?: RolePermissions[];
};
};
}
export const ErrorSchema = z.object({
error: z.string(),
@ -60,11 +33,6 @@ export type HonoEnv = {
};
export interface ApiRouteExports {
meta?: ApiRouteMetadata;
schemas?: {
query?: z.AnyZodObject;
body?: z.AnyZodObject;
};
default: (app: OpenAPIHono<HonoEnv>) => RouterRoute;
}