Account deletion: DELETE /employees/me
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
Direzione di ricerca
This is a planning issue; it names no implementation files or tests, and explicitly leaves tests out of scope. Read the listed sub-issues in order, starting with #141 and #142, then review #178–#180 for the database changes and endpoint branches. Done means the specified student and supervisor deletion behavior, notifications, file cleanup, and clerk updates are implemented across those issues.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
Students and supervisors have the right to delete all data associated with their account. This adds DELETE /employees/me, which deletes all clockwork-backend data for the caller identified by the JWT sub.
Supervisors/approvers (or the student/approvers) are notified about deleted petitions that were not completed.
Builds on the user_account linking: StudentDocuments (#144, done), PrevEmployment (#141), Petition student_user_account (#142).
Decisions
-
Student deletion cascade-deletes all their data, including all petitions (completed too), via DB
ON DELETE CASCADEon every FK toemployee.user_account(StudentDocuments, PrevEmployment, Petition.student_user_account) and onbudget_position.petition_id. -
Scope: clockwork-backend data only. Deleting the auth-service account is out of scope.
-
One endpoint
DELETE /employees/me. Identity comes from the JWTsubonly, with no id in the path. It usesdecode_user_jwtand notget_current_student(which would auto-create the Employee), and branches onuser_role:- student → delete the Employee (DB cascade).
204, or404if no Employee exists - supervisor → app-level logic (supervisors have no Employee row). Always
204 - clerk →
403
- student → delete the Employee (DB cascade).
-
Supervisor deletion:
4.1 Supervisor's non-completed petitions (Petition.user_account == sub) are deleted.
4.2 On completed petitions,user_accountandsupervisor_mailare set toNULL, so the student's contract record survives. -
Notifications are sent only for affected non-completed petitions:
- student deletion → supervisor + all budget approvers
- supervisor deletion → student + all budget approvers
They're sent explicitly from the handler (no mapper hooks) through
EmailHandler+BackgroundTasksafter commit, using data captured before the delete (petition id, student_username, start/end date, status). One DE+EN mail per recipient per petition. -
Uploaded files are removed explicitly in the handler: collect file names → delete rows → commit →
delete_student_doc_file/delete_prev_emp_file(api/utils.py). Best effort: failures are logged and the request still succeeds. -
JWT still valid after deletion: a later student request makes
get_current_studentrecreate empty Employee/StudentDocuments rows. This is accepted, and the frontend logs out right after the204. -
Clerk websocket push: after commit, send the refreshed clerk petition list via
send_serialized_data_to_clerks, but only if an affected petition had a clerk-relevant status (same list asapi/events/petition_events.py). -
Invariant change: "supervisor_mail is always present" now holds for non-completed petitions only.
Petition.user_account/supervisor_mailand theirPetitionReadfields become Optional.
Sub-issues (order)
#141 → #142 → #178 (DB cascades + nullable supervisor fields) → #179 (endpoint + student branch) → #180 (supervisor branch)
Frontend notes
- Call
DELETE /employees/me, then log out immediately on204 PetitionRead.user_accountandsupervisor_mailmay benull(completed petitions of deleted supervisors)
Out of scope
- Deleting the account in the auth microservice
- Tests (planning issue)
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 0
- Merge medio
- 12h 7m
- PR unite (30g)
- 18
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ClockGU/clockwork-backend
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
ClockGU/clockwork-backend#189 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
ClockGU/clockwork-backend#183 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ClockGU/clockwork-backend#182 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ClockGU/clockwork-backend#169 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
ClockGU/clockwork-backend#180 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ClockGU/clockwork-backend
Issue simili
-
separate_packages splits imports from the same explicitly configured packageForse già presa @rahul05ranjan l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
TigreGotico/text2spoken#626 ·
I maintainer di solito rispondono entro 1 giorno
-
oncoref MappingProxyType in proteome.layers breaks deepcopy in reference_coverage._inventoryForse già presa @iskandr l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
pipecat-ai/pipecat#7014 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
NL-BioImaging/biomero#136 ·
I maintainer di solito rispondono entro 1 giorno