feat: add operatorId to l-a-s middlewares
fix: make changes to db event handler to receive more complex payloads feat: machine actions previously on REST now work based on notifications feat: state middleware now operates based on operatorId as well chore: remove old localAppRoutes related code
This commit is contained in:
parent
32e5b1ba87
commit
7135a03654
11 changed files with 71 additions and 78 deletions
|
|
@ -157,18 +157,37 @@ function unpair (rec) {
|
|||
}
|
||||
|
||||
function reboot (rec) {
|
||||
return axios.post(`http://localhost:3030/reboot?device_id=${rec.deviceId}`)
|
||||
return db.none('NOTIFY $1:name, $2', ['poller', JSON.stringify(
|
||||
{
|
||||
type: 'machineAction',
|
||||
action: 'reboot',
|
||||
value: _.pick(['deviceId', 'operatorId', 'action'], rec)
|
||||
}
|
||||
)])
|
||||
}
|
||||
|
||||
function shutdown (rec) {
|
||||
return axios.post(`http://localhost:3030/shutdown?device_id=${rec.deviceId}`)
|
||||
return db.none('NOTIFY $1:name, $2', ['poller', JSON.stringify(
|
||||
{
|
||||
type: 'machineAction',
|
||||
action: 'shutdown',
|
||||
value: _.pick(['deviceId', 'operatorId', 'action'], rec)
|
||||
}
|
||||
)])
|
||||
}
|
||||
|
||||
function restartServices (rec) {
|
||||
return axios.post(`http://localhost:3030/restartServices?device_id=${rec.deviceId}`)
|
||||
return db.none('NOTIFY $1:name, $2', ['poller', JSON.stringify(
|
||||
{
|
||||
type: 'machineAction',
|
||||
action: 'restartServices',
|
||||
value: _.pick(['deviceId', 'operatorId', 'action'], rec)
|
||||
}
|
||||
)])
|
||||
}
|
||||
|
||||
function setMachine (rec) {
|
||||
function setMachine (rec, operatorId) {
|
||||
rec.operatorId = operatorId
|
||||
switch (rec.action) {
|
||||
case 'rename': return renameMachine(rec)
|
||||
case 'emptyCashInBills': return emptyCashInBills(rec)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue