From 18d2415ac8e722c596946692cc9cba34c98b8116 Mon Sep 17 00:00:00 2001 From: Cedric Evers <12080057+CeEv@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:19:38 +0100 Subject: [PATCH] Add comments --- .../src/modules/lesson/service/lesson.service.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/server/src/modules/lesson/service/lesson.service.ts b/apps/server/src/modules/lesson/service/lesson.service.ts index 4455fc2dc62..7c0b203a78c 100644 --- a/apps/server/src/modules/lesson/service/lesson.service.ts +++ b/apps/server/src/modules/lesson/service/lesson.service.ts @@ -24,13 +24,13 @@ export class LessonService implements AuthorizationLoaderService { !!! each delete of a entity bring us to lost a litte bit more connection, than bring us to situation that is harder to cleanup later !!! "user deleted" -> remove removeUserFromFileRecord() => for each fileRecord.cretor() "lesson deleted" -> rabbitMQ(apiLayer) > UC no auhtorisation > deletFileRecordsOfParent(lessonId, { deletedAt: Date.now() }) -> delte all fileRecords delete all S3 binary files - // -> after 7 days + // -> default deletedAt is 7 days !!! important this is the smae between course and lesson for example !!! // Question when event "user deleted" event is popup from which instance ? After 14 days this event is shedulled. // for filesstorage execution is zero days -> all fine S3 cleanup data and mongoDB too by it self - // console application + // console application sheduled the user deletion event */ await this.filesStorageClientAdapterService.deleteFilesOfParent(lesson.id); @@ -75,7 +75,12 @@ export class LessonService implements AuthorizationLoaderService { const result = await this.deleteLesson(); // required event that external systems can be react on it ...can do by application or a later cleanup job that remove all what have no user anymore - // S3 can only came to limits ..deletion request are smaller but + // S3 can only came to limits ..deletion request are smaller but should use a batch + + if we do not implement the "if" now, + than the cleanup job for entities without user can only work when events are implemented + and they shedule this events. + But if we lost the user before we can not execute the fileRecord.creator event anymore. } */ return updatedLessons.length;