Room Office Mapping / Home screen now functional / Bugfixes

This commit is contained in:
Senad Uka
2019-08-28 17:43:18 +02:00
parent 45e6abdba4
commit 30c152db55
10 changed files with 410 additions and 23 deletions

View File

@@ -70,7 +70,19 @@ const getResourceMappings = () => {
};
const getMappingsFromDatabase = () => {
return db.officeResourceMapping.findAll();
return db.officeResourceMapping.findAll({order: [['id']]});
};
const deleteMappingById = (id) => {
return db.officeResourceMapping.destroy({where: {id}});
};
const updateMappingById = (id, mapping) => {
if (mapping.id) {
delete mapping.id;
}
return db.officeResourceMapping.update(mapping, {where: {id}});
};
const saveNewMappingToDatabase = (mapping) => {
@@ -83,4 +95,6 @@ module.exports = {
fetchResources,
getResourceMappings,
saveNewMappingToDatabase,
deleteMappingById,
updateMappingById,
};