feat: inplement auth for runs and runCases

This commit is contained in:
Takeshi Kimata
2024-06-08 08:52:19 +09:00
parent 07259f6daf
commit 2b5a806aee
24 changed files with 293 additions and 67 deletions

View File

@@ -5,10 +5,14 @@ const { DataTypes, Op } = require('sequelize');
module.exports = function (sequelize) {
const RunCase = defineRunCase(sequelize, DataTypes);
const { verifySignedIn } = require('../../middleware/auth')(sequelize);
const { verifyProjectReporterFromRunId } = require('../../middleware/verifyEditable')(sequelize);
router.post('/bulkdelete', async (req, res) => {
router.post('/bulkdelete', verifySignedIn, verifyProjectReporterFromRunId, async (req, res) => {
const recordsToDelete = req.body;
// TODO Instead of receiving a combination of runId and caseId from frontend,
// receives only an array of caseId and constructs a pair from the query parameter runId
try {
const existingRunCases = await RunCase.findAll({
where: {