add delete mapping route, controller and implementation

This commit is contained in:
Bilal Catic
2019-08-28 09:30:19 +02:00
parent 8128247a74
commit 94f0bcc748
3 changed files with 26 additions and 2 deletions

View File

@@ -73,6 +73,10 @@ const getMappingsFromDatabase = () => {
return db.officeResourceMapping.findAll();
};
const deleteMappingById = (id) => {
return db.officeResourceMapping.destroy({where: {id}});
};
const saveNewMappingToDatabase = (mapping) => {
return db.officeResourceMapping.findOrCreate({where: {...mapping}, defaults: {...mapping}});
};
@@ -83,4 +87,5 @@ module.exports = {
fetchResources,
getResourceMappings,
saveNewMappingToDatabase,
deleteMappingById,
};