Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Petition: link student user_account on creation / first login; clerk endpoints by petition

Open
#142 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python, sql
Domain
api, backend, database

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: nullable uuid, FK → employee.user_account with ON UPDATE CASCADE (same pattern as #138 / #141)
  • On petition creation: if an Employee with student_username exists, set it immediately
  • On first login (branch in api/security.py where 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 via petition.student_user_account instead of the username join (contract unchanged)
  • Replace GET /clerk/prev_employments/petition/{petition_id} with GET /clerk/petitions/{petition_id}/prev_employments, resolved via petition.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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ClockGU/clockwork-backend

All issues in ClockGU/clockwork-backend

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.