mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-28 21:12:37 +02:00
mcu api
This commit is contained in:
parent
eb29686a90
commit
8b983c7826
13
src/graphql/graphqlModules/Mcu/Mcu.js
Normal file
13
src/graphql/graphqlModules/Mcu/Mcu.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports.typeDefs = `
|
||||
type Query {
|
||||
Mcu: McuActions
|
||||
}
|
||||
`
|
||||
|
||||
module.exports.resolvers = {
|
||||
Query: {
|
||||
Mcu () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
13
src/graphql/graphqlModules/Mcu/McuReboot.js
Normal file
13
src/graphql/graphqlModules/Mcu/McuReboot.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports.typeDefs = `
|
||||
type McuActions {
|
||||
reboot: EmptyOutput!
|
||||
}
|
||||
`
|
||||
|
||||
module.exports.resolvers = {
|
||||
McuActions: {
|
||||
reboot (root, args, { dispatch }) {
|
||||
return dispatch('api/mcu/reboot')
|
||||
}
|
||||
}
|
||||
}
|
13
src/graphql/graphqlModules/Mcu/McuShutdown.js
Normal file
13
src/graphql/graphqlModules/Mcu/McuShutdown.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports.typeDefs = `
|
||||
type McuActions {
|
||||
shutdown: EmptyOutput!
|
||||
}
|
||||
`
|
||||
|
||||
module.exports.resolvers = {
|
||||
McuActions: {
|
||||
shutdown (root, args, { dispatch }) {
|
||||
return dispatch('api/mcu/shutdown')
|
||||
}
|
||||
}
|
||||
}
|
7
src/store/api/mcu/mcuReboot.js
Normal file
7
src/store/api/mcu/mcuReboot.js
Normal file
@ -0,0 +1,7 @@
|
||||
const { exec } = require('child_process')
|
||||
|
||||
module.exports = ({ define }) => {
|
||||
define('reboot', async (payload, { knex, errors, utils }) => {
|
||||
exec('shutdown -r now')
|
||||
})
|
||||
}
|
7
src/store/api/mcu/mcuShutdown.js
Normal file
7
src/store/api/mcu/mcuShutdown.js
Normal file
@ -0,0 +1,7 @@
|
||||
const { exec } = require('child_process')
|
||||
|
||||
module.exports = ({ define }) => {
|
||||
define('shutdown', async (payload, { knex, errors, utils }) => {
|
||||
exec('shutdown now')
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user