diff --git a/src/mothership-app/pb_hooks/src/instances-delete.pb.js b/src/mothership-app/pb_hooks/src/instances-delete.pb.js index 4b6a047c..c2806182 100644 --- a/src/mothership-app/pb_hooks/src/instances-delete.pb.js +++ b/src/mothership-app/pb_hooks/src/instances-delete.pb.js @@ -16,13 +16,13 @@ routerAdd( const log = mkLog(`DELETE:instance`) - log(`***TOP OF DELETE`) + log(`TOP OF DELETE`) let data = new DynamicModel({ id: '', }) c.bind(data) - log(`***After bind`) + log(`After bind`) // This is necessary for destructuring to work correctly data = JSON.parse(JSON.stringify(data)) @@ -30,14 +30,14 @@ routerAdd( const id = c.pathParam('id') log( - `***vars`, + `vars`, JSON.stringify({ id, }), ) 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) { throw new BadRequestError(`Expected authRecord here`) @@ -56,9 +56,9 @@ routerAdd( } const path = [$os.getenv('DATA_ROOT'), id].join('/') - log(`***path ${path}`) + log(`path ${path}`) const res = $os.removeAll(path) - log(`***res`, res) + log(`res`, res) $app.dao().deleteRecord(record) diff --git a/src/mothership-app/pb_hooks/src/instances-migrate-versions.pb.js b/src/mothership-app/pb_hooks/src/instances-migrate-versions.pb.js index 869bc3a4..65a7550c 100644 --- a/src/mothership-app/pb_hooks/src/instances-migrate-versions.pb.js +++ b/src/mothership-app/pb_hooks/src/instances-migrate-versions.pb.js @@ -1,9 +1,9 @@ -/// - -/** - * Migrate version numbers - */ +/** Migrate version numbers */ onAfterBootstrap((e) => { + const { audit, mkLog } = /** @type {Lib} */ (require(`${__hooks}/lib.js`)) + + const log = mkLog(`bootstrap`) + const records = $app.dao().findRecordsByFilter(`instances`, '1=1') const { versions } = require(`${__hooks}/versions.js`) const unrecognized = [] @@ -28,5 +28,5 @@ onAfterBootstrap((e) => { unrecognized.push(v) } }) - unrecognized.forEach((v) => console.log(`***unrecognized ${v}`)) + log({ unrecognized }) }) diff --git a/src/mothership-app/pb_hooks/src/user-token.pb.js b/src/mothership-app/pb_hooks/src/user-token.pb.js index 4340c5e7..887c0fc2 100644 --- a/src/mothership-app/pb_hooks/src/user-token.pb.js +++ b/src/mothership-app/pb_hooks/src/user-token.pb.js @@ -9,9 +9,12 @@ routerAdd( 'GET', '/api/userToken/:id', (c) => { + const { mkLog } = /** @type {Lib} */ (require(`${__hooks}/lib.js`)) + const log = mkLog(`user-token`) + const id = c.pathParam('id') - console.log(`***vars`, JSON.stringify({ id })) + log({ id }) if (!id) { throw new BadRequestError(`User ID is required.`) @@ -21,7 +24,7 @@ routerAdd( const tokenKey = rec.getString('tokenKey') const passwordHash = rec.getString('passwordHash') const email = rec.getString(`email`) - console.log(`***tokenKey`, tokenKey) + log({ email, passwordHash, tokenKey }) return c.json(200, { email, passwordHash, tokenKey }) },