diff --git a/docker-compose.yml b/docker-compose.yml index e7aefcf..b62405b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,8 @@ services: # ports: # - 5432:5432 - + volumes: + - ./data/db:/var/lib/postgresql environment: POSTGRES_USER: bsfe POSTGRES_PASSWORD: Ch@NgEME! diff --git a/src/controllers/abstractproduct.js b/src/controllers/abstractproduct.js index 37a1043..94401a9 100644 --- a/src/controllers/abstractproduct.js +++ b/src/controllers/abstractproduct.js @@ -93,6 +93,10 @@ class AbstractProductController { async delete(req, res) { let { localId, groupId } = req.params; + let imageFilename = (await AbstractProductService.getByLocalId(groupId, localId)).image_filename + let imagePath = path.join(path.resolve(path.dirname('')), `/uploads/${imageFilename}.png`); + fs.unlinkSync(imagePath) + await AbstractProductService.delete(groupId, localId) notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'abstractproduct', { local_id: localId });