parent
49fdc9cad4
commit
c352fc5f0e
4 changed files with 43 additions and 2 deletions
@ -0,0 +1,27 @@ |
||||
import buildGetRequestHandler from '../buildGetRequestHandler'; |
||||
import join from '../../join'; |
||||
|
||||
const getServers = buildGetRequestHandler((request) => { |
||||
const { anvilsUUID } = request.body; |
||||
|
||||
const condAnvilsUUID = join(anvilsUUID, { |
||||
beforeReturn: (toReturn) => |
||||
toReturn ? `AND server_anvil_uuid IN (${toReturn})` : '', |
||||
elementWrapper: "'", |
||||
separator: ', ', |
||||
}); |
||||
|
||||
console.log(`condAnvilsUUID=[${condAnvilsUUID}]`); |
||||
|
||||
return ` |
||||
SELECT |
||||
server_uuid, |
||||
server_name, |
||||
server_state, |
||||
server_host_uuid |
||||
FROM servers |
||||
WHERE server_state != 'DELETED' |
||||
${condAnvilsUUID};`;
|
||||
}); |
||||
|
||||
export default getServers; |
@ -0,0 +1,5 @@ |
||||
import echoRouter from './echo'; |
||||
import filesRouter from './files'; |
||||
import serversRouter from './servers'; |
||||
|
||||
export { echoRouter, filesRouter, serversRouter }; |
@ -0,0 +1,9 @@ |
||||
import express from 'express'; |
||||
|
||||
import getServers from '../lib/request_handlers/servers/getServers'; |
||||
|
||||
const router = express.Router(); |
||||
|
||||
router.get('/', getServers); |
||||
|
||||
export default router; |
Loading…
Reference in new issue