mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 16:51:15 +10:00
* fix: invitation validation * fix: lint
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import { CreateUserValidator } from "../../../auth/signup/simple.post";
|
||||
import { SharedRegisterValidator } from "../../../auth/signup/simple.post";
|
||||
|
||||
const CreateInvite = CreateUserValidator.and({
|
||||
expires: "Date",
|
||||
isAdmin: "boolean = false",
|
||||
}).configure(throwingArktype);
|
||||
const CreateInvite = SharedRegisterValidator.partial()
|
||||
.and({
|
||||
expires: "string",
|
||||
isAdmin: "boolean = false",
|
||||
})
|
||||
.configure(throwingArktype);
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
@ -16,8 +18,6 @@ export default defineEventHandler(async (h3) => {
|
||||
|
||||
const body = await readDropValidatedBody(h3, CreateInvite);
|
||||
|
||||
console.log(body);
|
||||
|
||||
const invitation = await prisma.invitation.create({
|
||||
data: body,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user