Create test run editor
This commit is contained in:
@@ -79,8 +79,10 @@ app.use("/attachments", attachmentsDownloadRoute);
|
||||
|
||||
// "/runs"
|
||||
const runsIndexRoute = require("./routes/runs/index")(sequelize);
|
||||
const runsShowRoute = require("./routes/cases/show")(sequelize);
|
||||
const runsNewRoute = require("./routes/runs/new")(sequelize);
|
||||
app.use("/runs", runsIndexRoute);
|
||||
app.use("/runs", runsShowRoute);
|
||||
app.use("/runs", runsNewRoute);
|
||||
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
29
backend/routes/runs/show.js
Normal file
29
backend/routes/runs/show.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const express = require("express");
|
||||
const router = express.Router();
|
||||
const defineRun = require("../../models/runs");
|
||||
const { DataTypes } = require("sequelize");
|
||||
|
||||
module.exports = function (sequelize) {
|
||||
const Run = defineRun(sequelize, DataTypes);
|
||||
|
||||
router.get("/:runId", async (req, res) => {
|
||||
const runId = req.params.runId;
|
||||
|
||||
if (!runId) {
|
||||
return res.status(400).json({ error: "runId is required" });
|
||||
}
|
||||
|
||||
try {
|
||||
const project = await Run.findByPk(runId);
|
||||
if (!project) {
|
||||
return res.status(404).send("Run not found");
|
||||
}
|
||||
res.json(project);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
res.status(500).send("Internal Server Error");
|
||||
}
|
||||
});
|
||||
|
||||
return router;
|
||||
};
|
||||
Reference in New Issue
Block a user