24 lines
455 B
JavaScript
24 lines
455 B
JavaScript
const db = require("../../db/db");
|
|
|
|
class ProvincesController {
|
|
async findAll(req, res) {
|
|
const params = req.query;
|
|
const tmpProvinces = await db.getProvinces();
|
|
|
|
let provinces = [];
|
|
|
|
tmpProvinces.forEach(element => {
|
|
provinces = [...provinces,{
|
|
code: element.id,
|
|
name: element.name
|
|
}];
|
|
})
|
|
|
|
return res.status(200).send({
|
|
data: provinces
|
|
})
|
|
}
|
|
}
|
|
|
|
module.exports = new ProvincesController();
|