Account deletion: DELETE /employees/me
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 20/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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)
- Vorherrschende Sprache
- Python
- Sterne
- 0
- Forks
- 0
- Ø Merge
- 12 Std. 7 Min.
- Gemergte PRs (30 T.)
- 18
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ClockGU/clockwork-backend
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
ClockGU/clockwork-backend#189 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
ClockGU/clockwork-backend#183 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
ClockGU/clockwork-backend#182 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
ClockGU/clockwork-backend#169 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
ClockGU/clockwork-backend#180 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in ClockGU/clockwork-backend
Ähnliche Issues
-
separate_packages splits imports from the same explicitly configured packageEvtl. vergeben @rahul05ranjan hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
TigreGotico/text2spoken#626 ·
Maintainer antworten meist innerhalb von 1 Tag
-
oncoref MappingProxyType in proteome.layers breaks deepcopy in reference_coverage._inventoryEvtl. vergeben @iskandr hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
pipecat-ai/pipecat#7014 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
NL-BioImaging/biomero#136 ·
Maintainer antworten meist innerhalb von 1 Tag