recator placement of code
This commit is contained in:
25
backend/datamart/getDatamart.route.ts
Normal file
25
backend/datamart/getDatamart.route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Router } from "express";
|
||||
import { apiReturn } from "../utils/returnHelper.utils.js";
|
||||
import { runDatamartQuery } from "./datamart.controller.js";
|
||||
|
||||
const r = Router();
|
||||
|
||||
r.get("/:name", async (req, res) => {
|
||||
const { name } = req.params;
|
||||
const options = new URLSearchParams(
|
||||
req.query as Record<string, string>,
|
||||
).toString();
|
||||
|
||||
const dataRan = await runDatamartQuery({ name, options });
|
||||
return apiReturn(res, {
|
||||
success: dataRan.success,
|
||||
level: "info",
|
||||
module: "datamart",
|
||||
subModule: "query",
|
||||
message: dataRan.message,
|
||||
data: dataRan.data,
|
||||
status: 200,
|
||||
});
|
||||
});
|
||||
|
||||
export default r;
|
||||
Reference in New Issue
Block a user