mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Db structure changes
This commit is contained in:
parent
6eef9fd1c0
commit
bf2f63e810
6 changed files with 19 additions and 93 deletions
|
@ -92,8 +92,6 @@ export default function (options: Options): any {
|
|||
|
||||
logger.DebugLog(`ID #${user.id}: ${req.url}`, 'auth', 1)
|
||||
|
||||
UpdateAccess(userDB, user, sessionID)
|
||||
|
||||
dbtools.Update(
|
||||
userDB,
|
||||
'sessions',
|
||||
|
@ -109,7 +107,6 @@ export default function (options: Options): any {
|
|||
userDB,
|
||||
'users',
|
||||
{
|
||||
lastIP: '0.0.0.0',
|
||||
lastAccess: utils.GetDateString(),
|
||||
},
|
||||
{
|
||||
|
@ -121,22 +118,6 @@ export default function (options: Options): any {
|
|||
}
|
||||
}
|
||||
|
||||
function UpdateAccess(db, user, sessionID) {
|
||||
const accesses = dbtools.Select(db, 'accesses', {
|
||||
userId: user.id,
|
||||
ip: '0.0.0.0',
|
||||
})
|
||||
|
||||
if (accesses.length === 0) {
|
||||
dbtools.Insert(db, 'accesses', {
|
||||
userID: user.id,
|
||||
ip: '0.0.0.0',
|
||||
sessionID: sessionID,
|
||||
date: utils.GetDateString(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function GetUserBySessionID(db: any, sessionID: string) {
|
||||
logger.DebugLog(`Getting user from db`, 'auth', 2)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue