refactor(striker-ui-api): relocate buildGetRequestHandler

main
Tsu-ba-me 3 years ago
parent b583035630
commit 035727b2e0
  1. 6
      striker-ui-api/src/lib/request_handlers/buildGetRequestHandler.ts
  2. 4
      striker-ui-api/src/lib/request_handlers/files/getFileDetail.ts
  3. 4
      striker-ui-api/src/lib/request_handlers/files/getFiles.ts

@ -1,8 +1,8 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { dbQuery } from '../../accessDB'; import { dbQuery } from '../accessDB';
const buildGetFiles = const buildGetRequestHandler =
(query: string | ((request: Request) => string)) => (query: string | ((request: Request) => string)) =>
(request: Request, response: Response) => { (request: Request, response: Response) => {
console.log('Calling CLI script to get data.'); console.log('Calling CLI script to get data.');
@ -30,4 +30,4 @@ const buildGetFiles =
response.json(queryStdout); response.json(queryStdout);
}; };
export default buildGetFiles; export default buildGetRequestHandler;

@ -1,7 +1,7 @@
import buildGetFiles from './buildGetFiles'; import buildGetRequestHandler from '../buildGetRequestHandler';
import buildQueryFilesDetail from './buildQueryFilesDetail'; import buildQueryFilesDetail from './buildQueryFilesDetail';
const getFileDetail = buildGetFiles((request) => const getFileDetail = buildGetRequestHandler((request) =>
buildQueryFilesDetail({ filesUUID: [request.params.fileUUID] }), buildQueryFilesDetail({ filesUUID: [request.params.fileUUID] }),
); );

@ -1,7 +1,7 @@
import buildGetFiles from './buildGetFiles'; import buildGetRequestHandler from '../buildGetRequestHandler';
import buildQueryFilesDetail from './buildQueryFilesDetail'; import buildQueryFilesDetail from './buildQueryFilesDetail';
const getFiles = buildGetFiles((request) => { const getFiles = buildGetRequestHandler((request) => {
const { filesUUID } = request.body; const { filesUUID } = request.body;
let query = ` let query = `

Loading…
Cancel
Save