Files
Sheep-Service/api/controllers/auth.controller.js
2025-03-31 00:22:21 +03:00

22 lines
672 B
JavaScript

const AuthService = require('../services/auth.service');
class AuthController {
async login(req, res) {
if (req.sheepId && req.sheepRole) {
const result = await AuthService.findUserByID(req.sheepId, req.sheepRole);
if (result) {
return res.status(200).send(result);
} else {
return res.status(404).send({
message: 'Sheep not found.'
});
}
} else {
return res
.status(403)
.send({ message: 'The sheep does not have enough rights.' });
}
}
}
module.exports = new AuthController();