Feat: warn admin before restarting services
This commit is contained in:
parent
a432d913be
commit
6994303069
6 changed files with 126 additions and 8 deletions
|
|
@ -12,6 +12,7 @@ const logs = require('../../logs')
|
|||
const settingsLoader = require('../../new-settings-loader')
|
||||
const tokenManager = require('../../token-manager')
|
||||
const blacklist = require('../../blacklist')
|
||||
const machineEventsByIdBatch = require("../../postgresql_interface").machineEventsByIdBatch
|
||||
|
||||
const serverVersion = require('../../../package.json').version
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ const typeDefs = gql`
|
|||
cassette1: Int
|
||||
cassette2: Int
|
||||
statuses: [MachineStatus]
|
||||
latestEvent: MachineEvent
|
||||
}
|
||||
|
||||
type Customer {
|
||||
|
|
@ -220,6 +222,16 @@ const typeDefs = gql`
|
|||
address: String!
|
||||
}
|
||||
|
||||
type MachineEvent {
|
||||
id: ID
|
||||
deviceId: String
|
||||
eventType: String
|
||||
note: String
|
||||
created: Date
|
||||
age: Float
|
||||
deviceTime: Date
|
||||
}
|
||||
|
||||
type Query {
|
||||
countries: [Country]
|
||||
currencies: [Currency]
|
||||
|
|
@ -227,6 +239,7 @@ const typeDefs = gql`
|
|||
accountsConfig: [AccountConfig]
|
||||
cryptoCurrencies: [CryptoCurrency]
|
||||
machines: [Machine]
|
||||
machine(deviceId: ID!): Machine
|
||||
customers: [Customer]
|
||||
customer(customerId: ID!): Customer
|
||||
machineLogs(deviceId: ID!, from: Date, until: Date, limit: Int, offset: Int): [MachineLog]
|
||||
|
|
@ -267,6 +280,9 @@ const typeDefs = gql`
|
|||
`
|
||||
|
||||
const transactionsLoader = new DataLoader(ids => transactions.getCustomerTransactionsBatch(ids))
|
||||
const machineEventsLoader = new DataLoader(ids => {
|
||||
return machineEventsByIdBatch(ids)
|
||||
}, { cache: false })
|
||||
|
||||
const notify = () => got.post('http://localhost:3030/dbChange')
|
||||
.catch(e => console.error('Error: lamassu-server not responding'))
|
||||
|
|
@ -278,6 +294,9 @@ const resolvers = {
|
|||
Customer: {
|
||||
transactions: parent => transactionsLoader.load(parent.id)
|
||||
},
|
||||
Machine: {
|
||||
latestEvent: parent => machineEventsLoader.load(parent.deviceId)
|
||||
},
|
||||
Query: {
|
||||
countries: () => countries,
|
||||
currencies: () => currencies,
|
||||
|
|
@ -285,6 +304,7 @@ const resolvers = {
|
|||
accountsConfig: () => accountsConfig,
|
||||
cryptoCurrencies: () => coins,
|
||||
machines: () => machineLoader.getMachineNames(),
|
||||
machine: (...[, { deviceId }]) => machineLoader.getMachine(deviceId),
|
||||
customers: () => customers.getCustomersList(),
|
||||
customer: (...[, { customerId }]) => customers.getCustomerById(customerId),
|
||||
funding: () => funding.getFunding(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue