Skip to content

Commit

Permalink
wip: avoid creating a file when it has to be overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanVicens committed Mar 21, 2024
1 parent ffd75d9 commit 040ba56
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ export class CreateFileOnOfflineFileUploaded

async on(event: OfflineContentsUploadedDomainEvent): Promise<void> {
try {
const hasToOverride = await this.fileToOverrideProvider.run();
const filePath = new FilePath(event.path);
const fileToOverride = await this.fileToOverrideProvider.run();

Logger.debug('!!!!!!!!!!!!!!!!!!!!');
Logger.debug('IT SHOULD OVERRIDE:', hasToOverride);
if (fileToOverride.isPresent()) {
Logger.debug('!!!!!!!!!!!!!!!!!!!!');
Logger.debug('IT SHOULD OVERRIDE:', fileToOverride.get());
return;
}

const filePath = new FilePath(event.path);
await this.creator.run(filePath, event.aggregateId, event.size);
} catch (err) {
Logger.error('[CreateFileOnOfflineFileUploaded]:', err);
Expand Down

0 comments on commit 040ba56

Please sign in to comment.