move report search handler to file

deepsource-autofix-76c6eb20
Dan Gowans 2022-09-27 10:44:40 -04:00
parent c1707043e6
commit eb11c0b11e
5 changed files with 38 additions and 18 deletions

View File

@ -0,0 +1,3 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;

View File

@ -0,0 +1,12 @@
import * as dateTimeFunctions from "@cityssm/expressjs-server-js/dateTimeFns.js";
import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js";
export const handler = (_request, response) => {
const rightNow = new Date();
const maps = getMaps();
response.render("report-search", {
headTitle: "Reports",
todayDateString: dateTimeFunctions.dateToString(rightNow),
maps
});
};
export default handler;

View File

@ -0,0 +1,19 @@
import type { RequestHandler } from "express";
import * as dateTimeFunctions from "@cityssm/expressjs-server-js/dateTimeFns.js";
import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js";
export const handler: RequestHandler = (_request, response) => {
const rightNow = new Date();
const maps = getMaps();
response.render("report-search", {
headTitle: "Reports",
todayDateString: dateTimeFunctions.dateToString(rightNow),
maps
});
};
export default handler;

View File

@ -1,13 +1,7 @@
import { Router } from "express";
import handler_search from "../handlers/reports-get/search.js";
import handler_reportName from "../handlers/reports-get/reportName.js";
import * as dateTimeFns from "@cityssm/expressjs-server-js/dateTimeFns.js";
export const router = Router();
router.get("/", (_request, response) => {
const rightNow = new Date();
response.render("report-search", {
headTitle: "Reports",
todayDateString: dateTimeFns.dateToString(rightNow)
});
});
router.get("/", handler_search);
router.all("/:reportName", handler_reportName);
export default router;

View File

@ -1,19 +1,11 @@
import { Router } from "express";
import handler_search from "../handlers/reports-get/search.js";
import handler_reportName from "../handlers/reports-get/reportName.js";
import * as dateTimeFns from "@cityssm/expressjs-server-js/dateTimeFns.js";
export const router = Router();
router.get("/", (_request, response) => {
const rightNow = new Date();
response.render("report-search", {
headTitle: "Reports",
todayDateString: dateTimeFns.dateToString(rightNow)
});
});
router.get("/", handler_search);
router.all("/:reportName", handler_reportName);