mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
refactor(api): ♻️ Properly reuse error messages and schemas
This commit is contained in:
parent
7112a66e4c
commit
65e2e19ff1
84 changed files with 478 additions and 597 deletions
|
|
@ -7,7 +7,6 @@ import { type SQL, eq } from "@versia/kit/drizzle";
|
|||
import { OpenIdAccounts } from "@versia/kit/tables";
|
||||
import { ApiError } from "~/classes/errors/api-error";
|
||||
import type { PluginType } from "~/plugins/openid";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
||||
export default (plugin: PluginType): void => {
|
||||
plugin.registerRoute("/api/v1/sso", (app) => {
|
||||
|
|
@ -41,14 +40,7 @@ export default (plugin: PluginType): void => {
|
|||
},
|
||||
},
|
||||
},
|
||||
404: {
|
||||
description: "Account not found",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: ErrorSchema,
|
||||
},
|
||||
},
|
||||
},
|
||||
404: ApiError.accountNotFound().schema,
|
||||
},
|
||||
}),
|
||||
async (context) => {
|
||||
|
|
@ -121,7 +113,7 @@ export default (plugin: PluginType): void => {
|
|||
description: "Account not found",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: ErrorSchema,
|
||||
schema: ApiError.zodSchema,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue