Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should deleting OtpUser also delete that user's MonitoredTrip, TripRequest, and TripSummary? #80

Closed
binh-dam-ibigroup opened this issue Sep 22, 2020 · 2 comments
Labels
question Further information is requested

Comments

@binh-dam-ibigroup
Copy link
Collaborator

Observed behavior

While reviewing this file, I'm realizing that upon deleting an OtpUser, we don't have a preDeleteHook to delete the following associated entities:

  • MonitoredTrip,
  • TripRequest,
  • TripSummary.

Should we?

@binh-dam-ibigroup binh-dam-ibigroup added the question Further information is requested label Sep 22, 2020
@landonreed
Copy link
Contributor

We just handled this in #64, did we not?

// Delete trip request history (related trip summaries are deleted in TripRequest#delete)
for (TripRequest request : TripRequest.requestsForUser(this.id)) {
boolean success = request.delete();
if (!success) {
LOG.error("Error deleting user's ({}) trip request {}", this.id, request.id);
return false;
}
}
// Delete monitored trips.
for (MonitoredTrip trip : MonitoredTrip.tripsForUser(this.id)) {
boolean success = trip.delete();
if (!success) {
LOG.error("Error deleting user's ({}) monitored trip {}", this.id, trip.id);
return false;
}
}

@binh-dam-ibigroup
Copy link
Collaborator Author

Thanks, so that is probably redundant code I saw in #78.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants