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
|
@ -15,9 +15,6 @@
|
|||
"type": "text",
|
||||
"unique": true
|
||||
},
|
||||
"lastIP": {
|
||||
"type": "text"
|
||||
},
|
||||
"notes": {
|
||||
"type": "text"
|
||||
},
|
||||
|
@ -46,15 +43,22 @@
|
|||
"pwGotFromCID": {
|
||||
"type": "number",
|
||||
"defaultZero": true
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"foreignKey": [
|
||||
{
|
||||
"keysFrom": ["userID"],
|
||||
"keysFrom": [
|
||||
"userID"
|
||||
],
|
||||
"table": "users",
|
||||
"keysTo": ["id"]
|
||||
"keysTo": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tableStruct": {
|
||||
|
@ -63,10 +67,6 @@
|
|||
"primary": true,
|
||||
"notNull": true
|
||||
},
|
||||
"ip": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"userID": {
|
||||
"type": "number",
|
||||
"notNull": true
|
||||
|
@ -83,58 +83,5 @@
|
|||
"notNull": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"accesses": {
|
||||
"foreignKey": [
|
||||
{
|
||||
"keysFrom": ["userID"],
|
||||
"table": "users",
|
||||
"keysTo": ["id"]
|
||||
}
|
||||
],
|
||||
"tableStruct": {
|
||||
"accessID": {
|
||||
"type": "integer",
|
||||
"primary": true,
|
||||
"autoIncrement": true
|
||||
},
|
||||
"userID": {
|
||||
"type": "number",
|
||||
"notNull": true
|
||||
},
|
||||
"ip": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"date": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"sessionID": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"veteranPWRequests": {
|
||||
"tableStruct": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"primary": true,
|
||||
"autoIncrement": true
|
||||
},
|
||||
"ip": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"count": {
|
||||
"type": "number",
|
||||
"defaultZero": true
|
||||
},
|
||||
"lastDate": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ function setup(data: SubmoduleData): any {
|
|||
if (requestingUser.avaiblePWRequests <= 0) {
|
||||
res.json({
|
||||
result: 'error',
|
||||
success: false,
|
||||
msg:
|
||||
'Too many passwords requested or cant request password yet, try later',
|
||||
})
|
||||
|
@ -88,6 +89,7 @@ function setup(data: SubmoduleData): any {
|
|||
pw: pw,
|
||||
avaiblePWRequests: 0,
|
||||
created: utils.GetDateString(),
|
||||
createdBy: requestingUser.id,
|
||||
})
|
||||
|
||||
logger.Log(
|
||||
|
@ -152,7 +154,6 @@ function setup(data: SubmoduleData): any {
|
|||
'users',
|
||||
{
|
||||
loginCount: user.loginCount + 1,
|
||||
lastIP: '0.0.0.0',
|
||||
lastLogin: utils.GetDateString(),
|
||||
},
|
||||
{
|
||||
|
@ -162,7 +163,6 @@ function setup(data: SubmoduleData): any {
|
|||
|
||||
dbtools.Insert(userDB, 'sessions', {
|
||||
id: sessionID,
|
||||
ip: '0.0.0.0',
|
||||
userID: user.id,
|
||||
isScript: isScript ? 1 : 0,
|
||||
createDate: utils.GetDateString(),
|
||||
|
|
|
@ -54,7 +54,7 @@ function GetApp(): ModuleType {
|
|||
auth({
|
||||
userDB: userDB,
|
||||
jsonResponse: false,
|
||||
exceptions: ['/favicon.ico', '/getVeteranPw'],
|
||||
exceptions: ['/favicon.ico'],
|
||||
})
|
||||
)
|
||||
app.use((req: Request, res, next) => {
|
||||
|
@ -90,7 +90,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
routes.forEach((route) => {
|
||||
logger.DebugLog(`Added route /${route}`, 'DataEditor routes', 1)
|
||||
app.get(`/${route}`, function(req: Request, res) {
|
||||
app.get(`/${route}`, function (req: Request, res) {
|
||||
res.redirect(`${route}.html`)
|
||||
})
|
||||
})
|
||||
|
@ -99,16 +99,16 @@ function GetApp(): ModuleType {
|
|||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function(req: Request, res) {
|
||||
app.get('/', function (req: Request, res) {
|
||||
res.end('hai')
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('*', function(req: Request, res) {
|
||||
app.get('*', function (req: Request, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
app.post('*', function(req: Request, res) {
|
||||
app.post('*', function (req: Request, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue