Petition: link student user_account on creation / first login; clerk endpoints by petition
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start with the migration and schema patterns in issues #138 and #141, then read api/security.py where first-login Employee creation is handled. Trace petition creation and both clerk routes named in the issue, and add integration tests for linking at creation and first login, preserving existing links, and resolving both endpoints without username lookups. Done means the schema, linking paths, routes, and acceptance tests all match the stated behavior.
Written by the indexing model from the issue text.
Description
Context
Petitions identify the student only by student_username (the supervisor only knows the username, and the student may not have an account yet). Usernames are fine for sending mail but not for identity: the planned account fusion maps several usernames of one human to one user. Clerk endpoints currently resolve students by username.
Decision
- Add
Petition.student_user_account: nullableuuid, FK →employee.user_accountwithON UPDATE CASCADE(same pattern as #138 / #141) - On petition creation: if an
Employeewithstudent_usernameexists, set it immediately - On first login (branch in
api/security.pywhere the Employee is created):UPDATE petition SET student_user_account = :sub WHERE student_username = :username AND student_user_account IS NULL - Username is used only once as the binding key; afterwards identity is
user_account
Tasks
- Migration + schema; backfill existing petitions from
employee.username - Linking on petition creation and on first login
-
GET /clerk/petitions/{petition_id}/documents(from #138): resolve viapetition.student_user_accountinstead of the username join (contract unchanged) - Replace
GET /clerk/prev_employments/petition/{petition_id}withGET /clerk/petitions/{petition_id}/prev_employments, resolved viapetition.student_user_account(breaking change for the frontend; remove the old route)
Acceptance criteria (integration tests)
- Petition for an existing student is linked at creation
- Petition for an unknown student is linked on the student's first login
- Already-linked petitions are not overwritten
- Both clerk endpoints work without any username lookup
Related: #138, #141
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 39m
- Merged PRs (30d)
- 10
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ClockGU/clockwork-backend
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ClockGU/clockwork-backend#169 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
ClockGU/clockwork-backend#165 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
ClockGU/clockwork-backend#164 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
ClockGU/clockwork-backend#163 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
ClockGU/clockwork-backend#162 ·
Maintainers usually reply within 1 day
All issues in ClockGU/clockwork-backend
Similar issues
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists itOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
btclib-org/btclib-node#2158 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
dbt-msft/dbt-sqlserver#897 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Gathin23/cleanyourtv#2770 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
vllm-project/vllm#64845 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
dekobon/big-code-analysis#1729 ·
Maintainers usually reply within 1 day