v3: fixes to database schema and user registration
This commit is contained in:
@@ -4,9 +4,9 @@ import {
|
||||
APIErrorCode,
|
||||
APIException,
|
||||
isLoginUserRequest,
|
||||
isRegisterUserRequest,
|
||||
isUpdateUserRequest,
|
||||
type PaginatedData,
|
||||
validateRegisterUserRequest,
|
||||
} from "../model/interfaces.ts";
|
||||
|
||||
import { createJWT, verifyPassword } from "../lib/jwt.ts";
|
||||
@@ -36,12 +36,9 @@ const router = new Router({ prefix: "/api/users" });
|
||||
router.post("/register", async (ctx) => {
|
||||
const body = await ctx.request.body.json();
|
||||
|
||||
if (!isRegisterUserRequest(body)) {
|
||||
throw new APIException(
|
||||
APIErrorCode.VALIDATION_ERROR,
|
||||
400,
|
||||
"Invalid request",
|
||||
);
|
||||
const registerError = validateRegisterUserRequest(body);
|
||||
if (registerError) {
|
||||
throw new APIException(APIErrorCode.VALIDATION_ERROR, 400, registerError);
|
||||
}
|
||||
|
||||
// Validate invite — throws 404/409 if bad
|
||||
|
||||
Reference in New Issue
Block a user