Skip to content

Commit

Permalink
Cleanup helper
Browse files Browse the repository at this point in the history
  • Loading branch information
neutcomp committed Apr 8, 2024
1 parent ed0be63 commit 3e4a95b
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions server/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,10 @@ import { H3Event } from 'h3';
import { getServerSession } from '#auth'
import prisma from '../../db/db';

export const UserSchema = Joi.object({
firstname: Joi.string().max(20).min(2).required(),
lastname: Joi.string().max(30).min(2).required(),
email: Joi.string().max(50).min(6).required().email()
})

export const UserUpdateSchema = Joi.object({
id: Joi.number().required(),
firstname: Joi.string().max(20).min(2).required(),
lastname: Joi.string().max(30).min(2).required(),
email: Joi.string().max(50).min(6).required().email()
})

export const UserDeleteSchema = Joi.object({
id: Joi.string().required()
})

export const LoginSchema = Joi.object({
email: Joi.string().max(50).min(6).required().email()
})

export const AttendeeSchema = Joi.object({
firstname: Joi.string().max(20).min(2).required(),
lastname: Joi.string().max(30).min(2).required(),
Expand All @@ -42,19 +25,11 @@ export const TournamentDeleteSchema = Joi.object({
id: Joi.number().required()
})

export const cookieName = 'isAuthenticated'

export const checkAuthentication = (event: H3Event) => {
return Boolean(event.context?.user);
}

export const getTokenId = async (event: H3Event) => {
const session = await getServerSession(event);

// If not authenticated do nothing
if (session) {


// Get the JWT token from the DB
const token = await prisma.user.findFirst({
where: {
Expand Down

0 comments on commit 3e4a95b

Please sign in to comment.