update login api
This commit is contained in:
1 parent
646c7aed1f
commit
9090d4e2ca
3 files changed
+12
-4
No files matched your search
+1
-1
@@ -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",
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "../lib",
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user