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

@@ -4,11 +4,15 @@ const defineRunCase = require('../../models/runCases');
const { DataTypes, Op } = require('sequelize');
module.exports = function (sequelize) {
const { verifySignedIn } = require('../../middleware/auth')(sequelize);
const { verifyProjectReporterFromRunId } = require('../../middleware/verifyEditable')(sequelize);
const RunCase = defineRunCase(sequelize, DataTypes);
router.post('/bulknew', async (req, res) => {
router.post('/bulknew', verifySignedIn, verifyProjectReporterFromRunId, async (req, res) => {
const recordsToCreate = 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: {