Skip to content

Commit

Permalink
Add more collections to graphql server.
Browse files Browse the repository at this point in the history
  • Loading branch information
riclolsen committed Sep 14, 2024
1 parent 8674448 commit 34b3175
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const ProtocolDriverInstance = mongoose.model(
logLevel: { type: Double, default: 1.0 },
nodeNames: { type: [String], default: ['mainNode'] },
keepProtocolRunningWhileInactive: { type: Boolean, default: false },
//activeNodeName: {type: String, default: ""},
//activeNodeKeepAliveTimeTag: {type: Date, default: null},
activeNodeName: {type: String, default: ""},
activeNodeKeepAliveTimeTag: {type: Date, default: null},
softwareVersion: {type: String, default: ""},
stats: {type: Object, default: null},
}),
'protocolDriverInstances'
)
Expand Down
32 changes: 32 additions & 0 deletions src/server_realtime_auth/graphql-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ async function initGQLServer(app, db) {
getTagsByGroup1(group1: String!): [Tag!]!
getTags(tags: [String]!): [Tag!]!
getTag(tag: String!): Tag
getProtocolDriverInstances: [ProtocolDriverInstance!]!
getProtocolConnections: [ProtocolConnection!]!
}
type SourceDataUpdate {
Expand Down Expand Up @@ -106,6 +108,30 @@ async function initGQLServer(app, db) {
zeroDeadband: Float
sourceDataUpdate: SourceDataUpdate
}
type ProtocolDriverInstance {
_id: ID!
protocolDriver: String!
protocolDriverInstanceNumber: Float!
enabled: Boolean
logLevel: Float
nodeNames: [String]
keepProtocolRunningWhileInactive: Boolean
activeNodeName: String
activeNodeKeepAliveTimeTag: Float
softwareVersion: String
}
type ProtocolConnection {
_id: ID!
protocolDriver: String!
protocolDriverInstanceNumber: Float
protocolConnectionNumber: Float
name: String
description: String
enabled: Boolean
commandsEnabled: Boolean
}
`,
resolvers: {
Query: {
Expand All @@ -124,6 +150,12 @@ async function initGQLServer(app, db) {
getTag: async (_, qry) => {
return await db.tag.findOne({ tag: qry.tag })
},
getProtocolDriverInstances: async () => {
return await db.protocolDriverInstance.find()
},
getProtocolConnections: async () => {
return await db.protocolConnection.find()
},
},
},
})
Expand Down

0 comments on commit 34b3175

Please sign in to comment.