diff --git a/backend/src/server/context.ts b/backend/src/server/context.ts index 6de2adce4..805be90c6 100644 --- a/backend/src/server/context.ts +++ b/backend/src/server/context.ts @@ -1,9 +1,18 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +import { Role } from '@/auth/Role' +import { User as dbUser } from '@entity/User' -const context = (args: any) => { +export interface Context { + token: string | null + setHeaders: { key: string, value: string }[] + role?: Role + user?: dbUser +} + +const context = (args: any): Context => { const authorization = args.req.headers.authorization - let token = null + let token: string | null = null if (authorization) { token = authorization.replace(/^Bearer /, '') }