26 lines
783 B
JavaScript
26 lines
783 B
JavaScript
const historyApartmentService = require('../services/history.apartment.service');
|
|
|
|
class historyApartmentController {
|
|
async getList(req, res) {
|
|
const { limit } = req.query;
|
|
|
|
if (req.mode == 2) {
|
|
let result = await historyApartmentService.getList(limit);
|
|
if (result) {
|
|
return res
|
|
.status(200)
|
|
.send(result);
|
|
} else {
|
|
return res
|
|
.status(500)
|
|
.send({ message: 'Internal server error.' });
|
|
}
|
|
} else {
|
|
return res
|
|
.status(403)
|
|
.send({ message: 'The user does not have enough rights.' });
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = new historyApartmentController(); |