v0.0.1
This commit is contained in:
31
api/controllers/constructor.controller.js
Normal file
31
api/controllers/constructor.controller.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const ConstructorService = require('../services/constructor.service');
|
||||
|
||||
class ConstructorController {
|
||||
async createPack(req, res) {
|
||||
const data = req.body;
|
||||
|
||||
if (data) {
|
||||
if (req.sheepRole == "administrator" || req.moderator.can_add_territory) {
|
||||
let result = await ConstructorService.createPack(data);
|
||||
|
||||
if (result) {
|
||||
return res.status(200).send(result);
|
||||
} else {
|
||||
return res.status(500).send({
|
||||
message: 'Unable create pack.',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return res
|
||||
.status(403)
|
||||
.send({ message: 'The user does not have enough rights.' });
|
||||
}
|
||||
} else {
|
||||
return res
|
||||
.status(401)
|
||||
.send({ message: 'Users not found.' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new ConstructorController();
|
||||
Reference in New Issue
Block a user