Account deletion: DELETE /employees/me
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 20/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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)
- Lenguaje dominante
- Python
- Estrellas
- 0
- Forks
- 0
- Merge medio
- 12 h 7 min
- PR fusionados (30 d)
- 18
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ClockGU/clockwork-backend
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
ClockGU/clockwork-backend#189 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
ClockGU/clockwork-backend#183 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ClockGU/clockwork-backend#182 ·
Los mantenedores suelen responder en 1 día
-
Add alembic upgrade predeployAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ClockGU/clockwork-backend#169 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
ClockGU/clockwork-backend#180 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ClockGU/clockwork-backend
Issues similares
-
separate_packages splits imports from the same explicitly configured packagePosiblemente ocupada @rahul05ranjan la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
TigreGotico/text2spoken#626 ·
Los mantenedores suelen responder en 1 día
-
oncoref MappingProxyType in proteome.layers breaks deepcopy in reference_coverage._inventoryPosiblemente ocupada @iskandr la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
pipecat-ai/pipecat#7014 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
NL-BioImaging/biomero#136 ·
Los mantenedores suelen responder en 1 día