Merge branch 'master' of github.com:rts-cmk/dyrevelfaerd-api

This commit is contained in:
Brian Emilius
2021-02-10 14:56:48 +01:00
3 changed files with 24 additions and 2 deletions

View File

@@ -34,8 +34,26 @@ async function getSingleAsset(req, res, next) {
}
}
async function updateSingleAsset(req, res, next) {
try {
let asset = await Asset.findByPk(req.params.id);
if (asset) {
asset.url = req.fields.url;
asset.save();
res.json(asset);
} else {
res.status(404).end();
}
} catch(error) {
console.error(error);
res.status(500).end();
}
}
module.exports = {
createSingleAsset,
getAllAssets,
getSingleAsset
getSingleAsset,
updateSingleAsset
};