Додані повідомлення та перепрацьована структура застосунку та api

This commit is contained in:
2026-03-15 00:25:10 +02:00
parent 85483b85bb
commit 4bc9c11512
101 changed files with 5763 additions and 2546 deletions

View File

@@ -45,7 +45,7 @@ class SheepsController {
}
async getListStand(req, res) {
if (req.possibilities.can_view_stand) {
if (req.possibilities.can_view_stand) {
const result = await SheepsService.getListStand(req.mode);
if (result) {
@@ -86,7 +86,7 @@ class SheepsController {
const data = req.body;
if (req.mode == 2) {
let result = await SheepsService.updateSheep(data);
let result = await SheepsService.updateSheep(data, 2);
if (result) {
return res.status(200).send(result);
@@ -95,10 +95,24 @@ class SheepsController {
message: 'Unable update sheep.',
});
}
} if (req.possibilities.can_manager_sheeps) {
if (Number(data.mode) == 2) {
return res.status(403).send({ message: 'The sheep does not have enough rights.' });
} else {
let result = await SheepsService.updateSheep(data, 1);
if (result) {
return res.status(200).send(result);
} else {
return res.status(500).send({
message: 'Unable update sheep.',
});
}
}
} else {
return res
.status(403)
.send({ message: 'Sheep not foundThe sheep does not have enough rights.' });
.send({ message: 'The sheep does not have enough rights.' });
}
}