Refactor the way Abstract and Book Covers are being managed.
Refactor the way we save the Cover to the backend . Seperate the logic of saving the file and removing it from update Book and Collection.
-
Decouple the fileCover and fileAbstract saving part in the files : server/services/CommandService/domainCommands/commands/updateCommand.js
,server/services/CommandService/domainCommands/commands/updateCollectionCommand.js
data.fileCover = FileService.saveFile(this.fileCover, 'cover')
data.fileAbstract = FileService.saveFile(this.fileAbstract, 'abstract')
-
Move to the file server/services/file/fileService
, the update of the cover and abstract object (just return the id of the file if exists else return null) as new static function -
Currently it only removes only the cover from Files Table if the fileCover is empty, Should be done the same and for the fileAbstract.