Complete backend

This commit is contained in:
2020-02-08 19:59:51 +01:00
parent 06b2078e4d
commit 4379b4d231
19 changed files with 1178 additions and 29 deletions

22
api/models/citiesModel.js Normal file
View File

@@ -0,0 +1,22 @@
const db = require('../../data/dbConfig');
module.exports = {
getCities,
getCitiesByCountry
// getCity,
};
function getCities() {
return db('cities')
}
function getCitiesByCountry(country_id) {
return db('cities')
.where({ country_id })
}
// function getCity(name) {
// return db('cities')
// .where({ name })
// .first()
// }

View File

@@ -0,0 +1,16 @@
const db = require('../../data/dbConfig');
module.exports = {
getCountries,
getCountryByName,
};
function getCountries() {
return db('countries')
}
function getCountryByName(name) {
return db('countries')
.where({ name })
.first()
}

9
api/models/roadsModel.js Normal file
View File

@@ -0,0 +1,9 @@
const db = require('../../data/dbConfig');
module.exports = {
getRoads
};
function getRoads() {
return db('roads')
}