Remove validation for survey name
This commit is contained in:
parent
74751cf357
commit
c7f0846897
@ -7,21 +7,11 @@ const EstablishmentUser = db.EstablishmentUser;
|
|||||||
const { sendEmailService } = require("../services/email.service");
|
const { sendEmailService } = require("../services/email.service");
|
||||||
|
|
||||||
// Create new configuration
|
// Create new configuration
|
||||||
|
|
||||||
exports.createConfig = async (req, res) => {
|
exports.createConfig = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const {survey_name, quarter, year, start_date, end_date } = req.body;
|
const {quarter, year, start_date, end_date } = req.body;
|
||||||
|
|
||||||
const surveyNameExists = await QuarterlyWindowsConfiguration.findOne({
|
|
||||||
where: { survey_name, is_active: true }
|
|
||||||
});
|
|
||||||
|
|
||||||
if (surveyNameExists) {
|
|
||||||
return res.status(400).json({
|
|
||||||
status: "failed",
|
|
||||||
message: `Survey Name '${survey_name}' already exists.`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// find config
|
// find config
|
||||||
const exists = await QuarterlyWindowsConfiguration.findOne({where: { quarter, year }});
|
const exists = await QuarterlyWindowsConfiguration.findOne({where: { quarter, year }});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user