migrations and logs

This commit is contained in:
boufni95 2023-12-01 16:43:02 +01:00
parent db08370d5c
commit 03f803c4f4
11 changed files with 2353 additions and 2121 deletions

View file

@ -187,6 +187,17 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => {
})
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
break
case 'GetMigrationUpdate':
try {
if (!methods.GetMigrationUpdate) throw new Error('method: GetMigrationUpdate is not implemented')
const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier)
const query = req.query
const params = req.params
methods.GetMigrationUpdate({ ...authContext, ...query, ...params }, (response, err) => {
if (err) { logErrorAndReturnResponse(err, err.message, res, logger)} else { res({status: 'OK', ...response})}
})
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
break
default: logger.error('unknown rpc call name from nostr event:'+req.rpcName)
}
}