|
|
@ -1,7 +1,8 @@ |
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
import join from '../../join'; |
|
|
|
import join from '../../join'; |
|
|
|
|
|
|
|
|
|
|
|
export const getServer = buildGetRequestHandler((request) => { |
|
|
|
export const getServer = buildGetRequestHandler( |
|
|
|
|
|
|
|
(request, buildQueryOptions) => { |
|
|
|
const { anvilsUUID } = request.body; |
|
|
|
const { anvilsUUID } = request.body; |
|
|
|
|
|
|
|
|
|
|
|
const condAnvilsUUID = join(anvilsUUID, { |
|
|
|
const condAnvilsUUID = join(anvilsUUID, { |
|
|
@ -13,6 +14,25 @@ export const getServer = buildGetRequestHandler((request) => { |
|
|
|
|
|
|
|
|
|
|
|
console.log(`condAnvilsUUID=[${condAnvilsUUID}]`); |
|
|
|
console.log(`condAnvilsUUID=[${condAnvilsUUID}]`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (buildQueryOptions) { |
|
|
|
|
|
|
|
buildQueryOptions.afterQueryReturn = (queryStdout) => { |
|
|
|
|
|
|
|
let result = queryStdout; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queryStdout instanceof Array) { |
|
|
|
|
|
|
|
result = queryStdout.map<ServerOverview>( |
|
|
|
|
|
|
|
([serverUUID, serverName, serverState, serverHostUUID]) => ({ |
|
|
|
|
|
|
|
serverHostUUID, |
|
|
|
|
|
|
|
serverName, |
|
|
|
|
|
|
|
serverState, |
|
|
|
|
|
|
|
serverUUID, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ` |
|
|
|
return ` |
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
server_uuid, |
|
|
|
server_uuid, |
|
|
@ -22,4 +42,5 @@ export const getServer = buildGetRequestHandler((request) => { |
|
|
|
FROM servers |
|
|
|
FROM servers |
|
|
|
WHERE server_state != 'DELETED' |
|
|
|
WHERE server_state != 'DELETED' |
|
|
|
${condAnvilsUUID};`;
|
|
|
|
${condAnvilsUUID};`;
|
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|