floranet/api/controller/Provinces/provinces.controller.js

24 lines
455 B
JavaScript
Raw Normal View History

2024-03-06 17:16:03 +00:00
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();