432 lines
8.2 KiB
GraphQL
432 lines
8.2 KiB
GraphQL
scalar DateTime
|
|
scalar Date
|
|
scalar Long
|
|
|
|
type Query {
|
|
currentUser: User
|
|
|
|
getUsers(
|
|
page: Int!
|
|
pageSize: Int
|
|
query: String
|
|
roles: [UserRole!]
|
|
sortDirection: SortDirection!
|
|
sortField: UserSortField!
|
|
): UsersPage!
|
|
|
|
getUser(id: Long!): User
|
|
|
|
getMachines(
|
|
page: Int!
|
|
pageSize: Int
|
|
query: String
|
|
sortDirection: SortDirection!
|
|
sortField: MachineSortField!
|
|
): MachinesPage!
|
|
|
|
getMachine(id: Long!): Machine
|
|
|
|
getMachineTypes: [MachineType!]!
|
|
getDepartments: [Department!]!
|
|
getBeacons: [Beacon!]!
|
|
getFreeBeacons: [Beacon!]!
|
|
|
|
getBeaconTelemetry(
|
|
beaconId: Long
|
|
machineId: Long
|
|
startDate: DateTime!
|
|
endDate: DateTime!
|
|
): [BeaconTelemetryPacket!]!
|
|
|
|
getMachineStateDefinitions: [MachineStateDefinition!]!
|
|
getMachineCalibrationRules(machineId: Long!): [MachineCalibrationRule!]!
|
|
|
|
getMachineStateHistory(
|
|
machineId: Long!
|
|
startDate: DateTime!
|
|
endDate: DateTime!
|
|
page: Int
|
|
pageSize: Int
|
|
): MachineStateHistoryPage!
|
|
|
|
getMachineUsageSummary(
|
|
machineId: Long!
|
|
startDate: DateTime!
|
|
endDate: DateTime!
|
|
): MachineUsageSummary!
|
|
|
|
getUnrecognizedTelemetryIntervals(
|
|
machineId: Long!
|
|
startDate: DateTime!
|
|
endDate: DateTime!
|
|
): [MachineStateInterval!]!
|
|
|
|
getMachineDailyUsageStats(
|
|
machineId: Long!
|
|
startDate: DateTime!
|
|
endDate: DateTime!
|
|
): [MachineDailyUsageStat!]!
|
|
|
|
getFleetDailyReport(date: Date!): FleetDailyReport!
|
|
|
|
createFleetDailyReportDownloadUrl(
|
|
payload: GenerateFleetDailyReportPayload!
|
|
): ReportFile!
|
|
}
|
|
|
|
type Mutation {
|
|
login(payload: LoginPayload!): AuthPayload!
|
|
refreshSession(payload: RefreshSessionPayload!): AuthPayload!
|
|
logout: Boolean!
|
|
|
|
createUser(payload: CreateUserPayload!): User!
|
|
updateUser(id: Long!, payload: UpdateUserPayload!): User!
|
|
deleteUser(id: Long!): Boolean!
|
|
|
|
createMachine(payload: CreateMachinePayload!): Machine!
|
|
updateMachine(id: Long!, payload: UpdateMachinePayload!): Machine!
|
|
deleteMachine(id: Long!): Boolean!
|
|
|
|
bindBeaconToMachine(machineId: Long!, beaconId: Long!): Machine!
|
|
unbindBeaconFromMachine(machineId: Long!): Machine!
|
|
|
|
registerBeaconTelemetryPacket(payload: BeaconTelemetryPayload!): Boolean!
|
|
|
|
createMachineType(name: String!): MachineType!
|
|
updateMachineType(id: Long!, name: String!): MachineType!
|
|
deleteMachineType(id: Long!): Boolean!
|
|
|
|
createDepartment(name: String!): Department!
|
|
updateDepartment(id: Long!, name: String!): Department!
|
|
deleteDepartment(id: Long!): Boolean!
|
|
|
|
createMachineStateDefinition(payload: CreateMachineStateDefinitionPayload!): MachineStateDefinition!
|
|
updateMachineStateDefinition(id: Long!, payload: UpdateMachineStateDefinitionPayload!): MachineStateDefinition!
|
|
deleteMachineStateDefinition(id: Long!): Boolean!
|
|
|
|
createMachineCalibrationRule(payload: CreateMachineCalibrationRulePayload!): MachineCalibrationRule!
|
|
updateMachineCalibrationRule(id: Long!, payload: UpdateMachineCalibrationRulePayload!): MachineCalibrationRule!
|
|
deleteMachineCalibrationRule(id: Long!): Boolean!
|
|
|
|
recognizeMachineStates(machineId: Long!, startDate: DateTime!, endDate: DateTime!): [MachineStateInterval!]!
|
|
}
|
|
|
|
type AuthPayload {
|
|
user: User!
|
|
accessToken: String!
|
|
refreshToken: String!
|
|
token: String!
|
|
}
|
|
|
|
type User {
|
|
id: Long!
|
|
lastName: String!
|
|
firstName: String!
|
|
middleName: String
|
|
email: String!
|
|
login: String!
|
|
role: UserRole!
|
|
active: Boolean!
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
enum UserRole {
|
|
ADMIN
|
|
USER
|
|
}
|
|
|
|
type UsersPage {
|
|
totalPages: Int!
|
|
totalElements: Long!
|
|
page: [User!]!
|
|
}
|
|
|
|
enum UserSortField {
|
|
ID
|
|
NAME
|
|
DATE
|
|
}
|
|
|
|
enum SortDirection {
|
|
ASC
|
|
DESC
|
|
}
|
|
|
|
input LoginPayload {
|
|
loginOrEmail: String!
|
|
password: String!
|
|
}
|
|
|
|
input RefreshSessionPayload {
|
|
refreshToken: String!
|
|
}
|
|
|
|
input CreateUserPayload {
|
|
lastName: String!
|
|
firstName: String!
|
|
middleName: String
|
|
email: String!
|
|
login: String!
|
|
password: String!
|
|
role: UserRole!
|
|
}
|
|
|
|
input UpdateUserPayload {
|
|
lastName: String
|
|
firstName: String
|
|
middleName: String
|
|
email: String
|
|
login: String
|
|
password: String
|
|
role: UserRole
|
|
active: Boolean
|
|
}
|
|
|
|
type Machine {
|
|
id: Long!
|
|
name: String!
|
|
licensePlate: String!
|
|
type: MachineType!
|
|
department: Department!
|
|
description: String
|
|
beacon: Beacon
|
|
lastKnownState: MachineStateCode!
|
|
lastDataReceivedAt: DateTime
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
type MachineType {
|
|
id: Long!
|
|
name: String!
|
|
description: String
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
type Department {
|
|
id: Long!
|
|
name: String!
|
|
description: String
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
enum MachineStateCode {
|
|
IDLE
|
|
ENGINE_ON
|
|
MOVING
|
|
NO_DATA
|
|
}
|
|
|
|
type MachinesPage {
|
|
totalPages: Int!
|
|
totalElements: Long!
|
|
page: [Machine!]!
|
|
}
|
|
|
|
enum MachineSortField {
|
|
ID
|
|
NAME
|
|
DATE
|
|
}
|
|
|
|
input CreateMachinePayload {
|
|
name: String!
|
|
licensePlate: String!
|
|
typeId: Long!
|
|
departmentId: Long!
|
|
description: String
|
|
}
|
|
|
|
input UpdateMachinePayload {
|
|
name: String
|
|
licensePlate: String
|
|
typeId: Long
|
|
departmentId: Long
|
|
description: String
|
|
}
|
|
|
|
type Beacon {
|
|
id: Long!
|
|
identifier: String!
|
|
macAddress: String!
|
|
status: BeaconStatus!
|
|
boundMachine: Machine
|
|
lastSeenAt: DateTime
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
enum BeaconStatus {
|
|
FREE
|
|
BOUND
|
|
}
|
|
|
|
type BeaconTelemetryPacket {
|
|
id: Long!
|
|
beacon: Beacon!
|
|
machine: Machine
|
|
mac: String!
|
|
vibration: Float!
|
|
duration: Int!
|
|
timeMillis: Long!
|
|
receivedAt: DateTime!
|
|
}
|
|
|
|
input BeaconTelemetryPayload {
|
|
mac: String!
|
|
vibration: Float!
|
|
duration: Int!
|
|
timeMillis: Long!
|
|
}
|
|
|
|
type MachineStateDefinition {
|
|
id: Long!
|
|
name: String!
|
|
icon: String!
|
|
color: String!
|
|
description: String
|
|
isSystem: Boolean!
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
input CreateMachineStateDefinitionPayload {
|
|
name: String!
|
|
icon: String!
|
|
color: String!
|
|
description: String
|
|
}
|
|
|
|
input UpdateMachineStateDefinitionPayload {
|
|
name: String
|
|
icon: String
|
|
color: String
|
|
description: String
|
|
}
|
|
|
|
type MachineCalibrationRule {
|
|
id: Long!
|
|
machine: Machine!
|
|
stateDefinition: MachineStateDefinition!
|
|
vibrationMin: Float!
|
|
vibrationMax: Float!
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
input CreateMachineCalibrationRulePayload {
|
|
machineId: Long!
|
|
stateDefinitionId: Long!
|
|
vibrationMin: Float!
|
|
vibrationMax: Float!
|
|
}
|
|
|
|
input UpdateMachineCalibrationRulePayload {
|
|
stateDefinitionId: Long
|
|
vibrationMin: Float
|
|
vibrationMax: Float
|
|
}
|
|
|
|
type MachineStateInterval {
|
|
id: Long!
|
|
machine: Machine!
|
|
stateDefinition: MachineStateDefinition
|
|
stateCode: MachineStateCode
|
|
startedAt: DateTime!
|
|
endedAt: DateTime
|
|
durationSeconds: Int!
|
|
vibrationMin: Float
|
|
vibrationMax: Float
|
|
vibrationAvg: Float
|
|
sampleCount: Int!
|
|
isNoData: Boolean!
|
|
}
|
|
|
|
type MachineStateHistoryPage {
|
|
totalPages: Int!
|
|
totalElements: Long!
|
|
page: [MachineStateInterval!]!
|
|
}
|
|
|
|
type MachineUsageSummary {
|
|
machine: Machine!
|
|
periodStart: DateTime!
|
|
periodEnd: DateTime!
|
|
movingSeconds: Int!
|
|
engineOnSeconds: Int!
|
|
idleSeconds: Int!
|
|
noDataSeconds: Int!
|
|
stateChangesCount: Int!
|
|
utilizationPercent: Int!
|
|
}
|
|
|
|
type MachineDailyUsageStat {
|
|
machine: Machine!
|
|
date: String!
|
|
movingSeconds: Int!
|
|
engineOnSeconds: Int!
|
|
idleSeconds: Int!
|
|
noDataSeconds: Int!
|
|
utilizationPercent: Int!
|
|
}
|
|
|
|
type FleetDailyReport {
|
|
date: Date!
|
|
generatedAt: DateTime!
|
|
summary: FleetDailyReportSummary!
|
|
machines: [FleetDailyReportMachineRow!]!
|
|
history: [FleetDailyReportHistoryRow!]!
|
|
}
|
|
|
|
type FleetDailyReportSummary {
|
|
totalMachines: Int!
|
|
boundMachines: Int!
|
|
unboundMachines: Int!
|
|
machinesWithMovement: Int!
|
|
machinesWithoutData: Int!
|
|
movingSeconds: Int!
|
|
engineOnSeconds: Int!
|
|
idleSeconds: Int!
|
|
noDataSeconds: Int!
|
|
stateChangesCount: Int!
|
|
}
|
|
|
|
type FleetDailyReportMachineRow {
|
|
machine: Machine!
|
|
movingSeconds: Int!
|
|
engineOnSeconds: Int!
|
|
idleSeconds: Int!
|
|
noDataSeconds: Int!
|
|
stateChangesCount: Int!
|
|
utilizationPercent: Int!
|
|
}
|
|
|
|
type FleetDailyReportHistoryRow {
|
|
machine: Machine!
|
|
startedAt: DateTime!
|
|
endedAt: DateTime
|
|
stateDefinition: MachineStateDefinition
|
|
stateCode: MachineStateCode
|
|
durationSeconds: Int!
|
|
}
|
|
|
|
enum ReportFormat {
|
|
PDF
|
|
XLSX
|
|
}
|
|
|
|
input GenerateFleetDailyReportPayload {
|
|
date: Date!
|
|
format: ReportFormat!
|
|
}
|
|
|
|
type ReportFile {
|
|
fileName: String!
|
|
mimeType: String!
|
|
downloadUrl: String!
|
|
expiresAt: DateTime
|
|
}
|