Closed teresantns closed 2 years ago
If we wish to keep these instances for a data analysis purpose, we could change the logic to include a choice field instead of the boolean status field: we could have three choices: Accepted, Pending and Expired. This way, when the referral expires, it is not removed from the database. This would require some changes into the creating referral logic, to prevent that expired referrals can be accepted, and the
target_cpf
field would have to be non unique, since a user could have multiple referrals towards them (if the existing ones are expired).
crontab
or celery
, since it is independent of the rest of the code. This would require that the function is not called on the views.py
file, but automated.
The referrals need to be valid for only 30 days. After that, the referred user cannot accept the invitation anymore, and is free to be referred by another user.
So we need a function to delete referrals that are older than 30 days This function should be called before: (all endpoints, basically)
CreateReferralView
AcceptReferralView
GetReferralsView
GetUserReferralsView
GetReferralView
This can be later automated with a cronjob or a library like Celery
This can be a future enhancement of this project, if the deadline allows it.