mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
logging cleanup
This commit is contained in:
parent
113047034c
commit
5ae159b22f
@ -16,13 +16,13 @@ routerAdd(
|
|||||||
|
|
||||||
const log = mkLog(`DELETE:instance`)
|
const log = mkLog(`DELETE:instance`)
|
||||||
|
|
||||||
log(`***TOP OF DELETE`)
|
log(`TOP OF DELETE`)
|
||||||
let data = new DynamicModel({
|
let data = new DynamicModel({
|
||||||
id: '',
|
id: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
c.bind(data)
|
c.bind(data)
|
||||||
log(`***After bind`)
|
log(`After bind`)
|
||||||
|
|
||||||
// This is necessary for destructuring to work correctly
|
// This is necessary for destructuring to work correctly
|
||||||
data = JSON.parse(JSON.stringify(data))
|
data = JSON.parse(JSON.stringify(data))
|
||||||
@ -30,14 +30,14 @@ routerAdd(
|
|||||||
const id = c.pathParam('id')
|
const id = c.pathParam('id')
|
||||||
|
|
||||||
log(
|
log(
|
||||||
`***vars`,
|
`vars`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
id,
|
id,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const authRecord = /** @type {models.Record} */ (c.get('authRecord')) // empty if not authenticated as regular auth record
|
const authRecord = /** @type {models.Record} */ (c.get('authRecord')) // empty if not authenticated as regular auth record
|
||||||
log(`***authRecord`, JSON.stringify(authRecord))
|
log(`authRecord`, JSON.stringify(authRecord))
|
||||||
|
|
||||||
if (!authRecord) {
|
if (!authRecord) {
|
||||||
throw new BadRequestError(`Expected authRecord here`)
|
throw new BadRequestError(`Expected authRecord here`)
|
||||||
@ -56,9 +56,9 @@ routerAdd(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const path = [$os.getenv('DATA_ROOT'), id].join('/')
|
const path = [$os.getenv('DATA_ROOT'), id].join('/')
|
||||||
log(`***path ${path}`)
|
log(`path ${path}`)
|
||||||
const res = $os.removeAll(path)
|
const res = $os.removeAll(path)
|
||||||
log(`***res`, res)
|
log(`res`, res)
|
||||||
|
|
||||||
$app.dao().deleteRecord(record)
|
$app.dao().deleteRecord(record)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/// <reference path="../types/types.d.ts" />
|
/** Migrate version numbers */
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate version numbers
|
|
||||||
*/
|
|
||||||
onAfterBootstrap((e) => {
|
onAfterBootstrap((e) => {
|
||||||
|
const { audit, mkLog } = /** @type {Lib} */ (require(`${__hooks}/lib.js`))
|
||||||
|
|
||||||
|
const log = mkLog(`bootstrap`)
|
||||||
|
|
||||||
const records = $app.dao().findRecordsByFilter(`instances`, '1=1')
|
const records = $app.dao().findRecordsByFilter(`instances`, '1=1')
|
||||||
const { versions } = require(`${__hooks}/versions.js`)
|
const { versions } = require(`${__hooks}/versions.js`)
|
||||||
const unrecognized = []
|
const unrecognized = []
|
||||||
@ -28,5 +28,5 @@ onAfterBootstrap((e) => {
|
|||||||
unrecognized.push(v)
|
unrecognized.push(v)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
unrecognized.forEach((v) => console.log(`***unrecognized ${v}`))
|
log({ unrecognized })
|
||||||
})
|
})
|
||||||
|
@ -9,9 +9,12 @@ routerAdd(
|
|||||||
'GET',
|
'GET',
|
||||||
'/api/userToken/:id',
|
'/api/userToken/:id',
|
||||||
(c) => {
|
(c) => {
|
||||||
|
const { mkLog } = /** @type {Lib} */ (require(`${__hooks}/lib.js`))
|
||||||
|
const log = mkLog(`user-token`)
|
||||||
|
|
||||||
const id = c.pathParam('id')
|
const id = c.pathParam('id')
|
||||||
|
|
||||||
console.log(`***vars`, JSON.stringify({ id }))
|
log({ id })
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
throw new BadRequestError(`User ID is required.`)
|
throw new BadRequestError(`User ID is required.`)
|
||||||
@ -21,7 +24,7 @@ routerAdd(
|
|||||||
const tokenKey = rec.getString('tokenKey')
|
const tokenKey = rec.getString('tokenKey')
|
||||||
const passwordHash = rec.getString('passwordHash')
|
const passwordHash = rec.getString('passwordHash')
|
||||||
const email = rec.getString(`email`)
|
const email = rec.getString(`email`)
|
||||||
console.log(`***tokenKey`, tokenKey)
|
log({ email, passwordHash, tokenKey })
|
||||||
|
|
||||||
return c.json(200, { email, passwordHash, tokenKey })
|
return c.json(200, { email, passwordHash, tokenKey })
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user