Skip to content

Commit

Permalink
feat: delete account - integration - wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Radulescu committed Dec 19, 2023
1 parent bc7f35e commit 6491c57
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export class VolunteerRepositoryService
});
}

async deleteManyAndProfiles(
async softDeleteManyAndProfiles(
userId: string,
): Promise<{ deletedProfiles: string[]; deletedVolunteers: string[] }> {
const volunteerRecords = await this.volunteerRepository.find({
Expand Down
4 changes: 2 additions & 2 deletions backend/src/modules/volunteer/services/volunteer.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export class VolunteerFacade {
return this.volunteerProfileRepositoryService.delete(id);
}

async deleteManyAndProfiles(
async softDeleteManyAndProfiles(
userId: string,
): Promise<{ deletedProfiles: string[]; deletedVolunteers: string[] }> {
return this.volunteerRepository.deleteManyAndProfiles(userId);
return this.volunteerRepository.softDeleteManyAndProfiles(userId);
}
}
46 changes: 23 additions & 23 deletions backend/src/usecases/user/delete-account.usecase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,34 @@ export class DeleteAccountRegularUserUsecase implements IUseCaseService<void> {
/* =========FULL IMPLEMENTATION UNTESTED ================= */
/* ======================================================= */

// // 2. Hard delete all "PushTokens"
// await this.pushNotificationService.deleteMany({ userId });
// // 3. Hard delete "UserPersonalData"
// if (user.userPersonalData?.id) {
// await this.userService.deleteUserPersonalData(user.userPersonalData.id);
// }
// 2. Hard delete all "PushTokens"
await this.pushNotificationService.deleteMany({ userId });
// 3. Hard delete "UserPersonalData"
if (user.userPersonalData?.id) {
await this.userService.deleteUserPersonalData(user.userPersonalData.id);
}

// // 4. Hard delete all Volunteers Records and the associated Profiles for the given UserId
// const deletedVolunteersAndProfiles =
// await this.volunteerFacade.deleteManyAndProfiles(userId);
// 4. Hard delete all Volunteers Records and the associated Profiles for the given UserId
const deletedVolunteersAndProfiles =
await this.volunteerFacade.softDeleteManyAndProfiles(userId);

// // Delete activity logs related to this user
// await this.activityLogFacade.deleteMany(
// deletedVolunteersAndProfiles.deletedVolunteers,
// );
// Delete activity logs related to this user
await this.activityLogFacade.deleteMany(
deletedVolunteersAndProfiles.deletedVolunteers,
);

// // Delete all access requests made by the user
// await this.accessRequestFacade.deleteAllForUser(userId);
// Delete all access requests made by the user
await this.accessRequestFacade.deleteAllForUser(userId);

// // Delete all RSVPs to events for the user
// await this.eventFacade.deleteAllRSVPsForUser(userId);
// Delete all RSVPs to events for the user
await this.eventFacade.deleteAllRSVPsForUser(userId);

// // 4. "User" - Anonimize + Soft delete + Delete profile picture
// const deletedUser =
// await this.userService.softDeleteAndAnonimizeRegularUser(userId);
// if (deletedUser.profilePicture) {
// await this.s3Service.deleteFile(deletedUser.profilePicture);
// }
// 4. "User" - Anonimize + Soft delete + Delete profile picture
const deletedUser =
await this.userService.softDeleteAndAnonimizeRegularUser(userId);
if (deletedUser.profilePicture) {
await this.s3Service.deleteFile(deletedUser.profilePicture);
}

return;
}
Expand Down

0 comments on commit 6491c57

Please sign in to comment.