mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-19 09:44:50 -05:00
add suggestion backend
This commit is contained in:
@@ -2,6 +2,6 @@ import { User } from "@prisma/client";
|
||||
import { NextApiRequest } from "next";
|
||||
import { getSession } from "next-auth/client";
|
||||
|
||||
export const getMySession = (req?: NextApiRequest): Promise<User | null> =>
|
||||
export const getMySession = (req: NextApiRequest): Promise<User | null> =>
|
||||
// @ts-expect-error
|
||||
getSession({ req });
|
||||
|
||||
6
lib/errors.ts
Normal file
6
lib/errors.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class UserError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "UserError";
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ export const SUGGESTION_DESCRIPTION_LIMIT = 500;
|
||||
|
||||
export const suggestionSchema = z.object({
|
||||
description: z.string().max(SUGGESTION_DESCRIPTION_LIMIT),
|
||||
suggestedUserId: z.number().int(),
|
||||
suggestedId: z.number().int(),
|
||||
tier: z.number().int().min(1).max(3),
|
||||
region: z.enum(["NA", "EU"]),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user