diff --git a/apps/website/src/server/api/auth/me.get.ts b/apps/website/src/server/api/auth/me.get.ts index 8e241bdc..5b3618c6 100644 --- a/apps/website/src/server/api/auth/me.get.ts +++ b/apps/website/src/server/api/auth/me.get.ts @@ -1,6 +1,6 @@ export default defineEventHandler((event) => { const { public: publicEnv } = useRuntimeConfig(); - + const jwt = getCookie(event, publicEnv.cookieKey) if (!jwt) { throw createError({ @@ -14,4 +14,4 @@ export default defineEventHandler((event) => { twitchId: '12345', userName: 'testuser', } -}); \ No newline at end of file +}); diff --git a/apps/website/src/server/tsconfig.json b/apps/website/src/server/tsconfig.json index 3c6e968e..4c58c5fd 100644 --- a/apps/website/src/server/tsconfig.json +++ b/apps/website/src/server/tsconfig.json @@ -1,3 +1,8 @@ { + "compilerOptions": { + "paths": { + "@chat-game/prisma-client": ["../../../../libs/prisma-client/src/index.ts"] + } + }, "extends": "../../.nuxt/tsconfig.server.json" } diff --git a/libs/prisma-client/.eslintrc.json b/libs/prisma-client/.eslintrc.json new file mode 100644 index 00000000..9d9c0db5 --- /dev/null +++ b/libs/prisma-client/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/prisma-client/project.json b/libs/prisma-client/project.json new file mode 100644 index 00000000..fabe258f --- /dev/null +++ b/libs/prisma-client/project.json @@ -0,0 +1,8 @@ +{ + "name": "prisma-client", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/prisma-client/src", + "projectType": "library", + "tags": [], + "targets": {} +} diff --git a/libs/prisma-client/src/index.ts b/libs/prisma-client/src/index.ts new file mode 100644 index 00000000..f3d80fba --- /dev/null +++ b/libs/prisma-client/src/index.ts @@ -0,0 +1 @@ +export * from './lib/prisma-client'; diff --git a/libs/prisma-client/src/lib/prisma-client.ts b/libs/prisma-client/src/lib/prisma-client.ts new file mode 100644 index 00000000..020681b0 --- /dev/null +++ b/libs/prisma-client/src/lib/prisma-client.ts @@ -0,0 +1,3 @@ +import { PrismaClient } from '@prisma/client' + +export const db = new PrismaClient() diff --git a/libs/prisma-client/tsconfig.json b/libs/prisma-client/tsconfig.json new file mode 100644 index 00000000..db7b5666 --- /dev/null +++ b/libs/prisma-client/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/libs/prisma-client/tsconfig.lib.json b/libs/prisma-client/tsconfig.lib.json new file mode 100644 index 00000000..faa09cc1 --- /dev/null +++ b/libs/prisma-client/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index c6dec1dd..2375fe1a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -15,6 +15,7 @@ "skipDefaultLibCheck": true, "baseUrl": ".", "paths": { + "@chat-game/prisma-client": ["libs/prisma-client/src/index.ts"], "@chat-game/prisma-schema": ["libs/prisma-schema/src/index.ts"] } },