mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
feat: openapi support plus more api validation
This commit is contained in:
@ -15,7 +15,9 @@ const signinValidator = type({
|
||||
"rememberMe?": "boolean | undefined",
|
||||
});
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
export default defineEventHandler<{
|
||||
body: typeof signinValidator.infer;
|
||||
}>(async (h3) => {
|
||||
if (!enabledAuthManagers.Simple)
|
||||
throw createError({
|
||||
statusCode: 403,
|
||||
|
||||
@ -7,13 +7,16 @@ import { type } from "arktype";
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
const userValidator = type({
|
||||
invitation: "string",
|
||||
username: "string >= 5",
|
||||
email: "string.email",
|
||||
password: "string >= 14",
|
||||
"displayName?": "string | undefined",
|
||||
});
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
export default defineEventHandler<{
|
||||
body: typeof userValidator.infer;
|
||||
}>(async (h3) => {
|
||||
const body = await readBody(h3);
|
||||
|
||||
const invitationId = body.invitation;
|
||||
|
||||
Reference in New Issue
Block a user