finished actions => handlers refacto, small bux fix in maestro => Test maestro1 OK
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { assembleHandlers, createDispatchMessage } from '../../../bus/assembleMesh.js'
|
||||
import * as utilities from './utilities.js'
|
||||
|
||||
const { actionHandlers, eventHandlers, afterLogin } = assembleHandlers([utilities])
|
||||
|
||||
export { actionHandlers, afterLogin }
|
||||
|
||||
export const dispatchMessage = createDispatchMessage({
|
||||
eventHandlers,
|
||||
actionRules(redisCnx) {
|
||||
const gps = redisCnx.config.gps ?? {}
|
||||
return({
|
||||
channels: [gps.gpsActionsChannel].filter(Boolean),
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,33 @@
|
||||
import { replyToAction } from '../../../bus/publishActionReply.js'
|
||||
|
||||
export const actions = {
|
||||
|
||||
async action_TIME(action, payload, reqid, sender, roles) {
|
||||
replyToAction(this, {
|
||||
action,
|
||||
reqid,
|
||||
sender,
|
||||
success: true,
|
||||
payload: {
|
||||
gpsTime: new Date().toISOString(),
|
||||
redisTime: await this.redisClient.time(),
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
async action_RELOADCONFIG(action, payload, reqid, sender, roles) {
|
||||
this.reloadAccessRights()
|
||||
replyToAction(this, { action, reqid, sender, success: true })
|
||||
},
|
||||
|
||||
async action_GETCONFIG(action, payload, reqid, sender, roles) {
|
||||
replyToAction(this, {
|
||||
action,
|
||||
reqid,
|
||||
sender,
|
||||
success: true,
|
||||
payload: this.getAccessRights(),
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user