refactor(api): ♻️ Properly reuse error messages and schemas

This commit is contained in:
Jesse Wierzbinski 2025-03-24 14:42:09 +01:00
parent 7112a66e4c
commit 65e2e19ff1
No known key found for this signature in database
84 changed files with 478 additions and 597 deletions

View file

@ -9,7 +9,6 @@ import { Notes } from "@versia/kit/tables";
import { and, eq, inArray } from "drizzle-orm";
import { ApiError } from "~/classes/errors/api-error";
import { config } from "~/config.ts";
import { ErrorSchema } from "~/types/api";
const schemas = {
param: z.object({
@ -43,7 +42,7 @@ const route = createRoute({
description: "User not found",
content: {
"application/json": {
schema: ErrorSchema,
schema: ApiError.zodSchema,
},
},
},
@ -51,7 +50,7 @@ const route = createRoute({
description: "Cannot view users from remote instances",
content: {
"application/json": {
schema: ErrorSchema,
schema: ApiError.zodSchema,
},
},
},