From adb8b7c2ff360f789c89d484c49ba1cd9e20d367 Mon Sep 17 00:00:00 2001 From: Yasmim Rosa Date: Mon, 11 Dec 2023 10:41:49 -0300 Subject: [PATCH] =?UTF-8?q?backend=20abertura=20de=20matr=C3=ADcula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/SuperuserController.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/controllers/SuperuserController.js b/backend/controllers/SuperuserController.js index 09817a3b..bc7caa7a 100644 --- a/backend/controllers/SuperuserController.js +++ b/backend/controllers/SuperuserController.js @@ -1,3 +1,18 @@ +const Register = require('../models/schemas/RegistrationPeriod') + exports.openRegistrationPeriod = async (req, res) => { - + const { name, isOpen, start, end } = req.body; + + await Register.create({ + name: name, + isOpen: isOpen, + start: start, + end: end, + }).then(() => { + res.status(201).json("OK") + }).catch((err) => { + if(err){ + res.status(400).json({error: err}); + }; + }); } \ No newline at end of file