biocore / microsetta-private-api

A private microservice to support The Microsetta Initiative
BSD 3-Clause "New" or "Revised" License
6 stars 19 forks source link

Bug on account delete when a user has secondary surveys #469

Closed wasade closed 1 year ago

wasade commented 1 year ago

Originally noted by @cassidysymons, as he noted:

"I just discovered an interesting bug in the account deletion functionality. When a user has taken any of the three optional surveys that are remote - MyFoodRepo, Spanish FFQ, or Polyphenol FFQ - deleting their account will fail. Digging into it, all of the registry tables for those external surveys are set up similarly (I believe I patterned SFFQ and PFFQ after MFR), with the key aspect being that account_id is a foreign key reference ag.account.id and more importantly, is not null."

On inspection, the criteria to delete rather than scrub is based on the presence of samples associated to the account, and does not explicitly test for surveys which may depend on account / source relationships.