diff --git a/package.json b/package.json index 75bf10e..fcb918b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "license": "MIT", "scripts": { "ts": "ts-node", - "build": "rm -r lib && tsc --rootDir src --outDir lib" + "build": "rm -r lib && tsc -p src/tsconfig.json" }, "dependencies": { "@databases/pg": "^5.1.1", diff --git a/src/api/index.ts b/src/api/index.ts index d544eba..8518ca7 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -117,10 +117,10 @@ const apiRouter: FastifyPluginAsync = async (f) => { const userId = userData.data.id await db.query(sql` - INSERT INTO "user" ("id", "level") - VALUES (${userId}, ${userData.data.level}) + INSERT INTO "user" ("id", "identifier", "level.max") + VALUES (${userId}, ${userData.data.username}, ${userData.data.level}) ON CONFLICT ("id") DO UPDATE SET - "level" = EXCLUDED."level" + "level.max" = EXCLUDED."level.max" `) req.session['userId'] = userId diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 0000000..42905d2 --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "../lib", + "sourceMap": true + } +} \ No newline at end of file