refactor(store): wave B.18 — assignment repo (closes action chain) (#279)#280
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds a store-level Assignment domain, a Postgres-backed AssignmentRepo, wires it into Repos, and updates handlers to call the new repository methods instead of direct sqlc query-layer calls. ChangesAssignment Repository Migration
Sequence DiagramsequenceDiagram
participant Handler as API Handler
participant Repo as AssignmentRepo
participant DB as Postgres/sqlc
Handler->>Repo: Get(AssignmentKey) / List(filter) / Count(filter)
Repo->>DB: corresponding sqlc query (GetAssignment / ListAssignments / CountAssignments)
DB-->>Repo: rows or count
Repo-->>Handler: domain Assignment / AssignmentWithNames / count
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
AssignmentRepo closes the action-chain migration (Action → ActionSet → Definition → Execution → Assignment). Read side of assignments_projection: Get / GetByID / List(filter) / Count(filter) / ListAvailableForDevice / ListAssignedUserIDsForDevice List returns AssignmentWithNames (joined source_name + target_name) for the list UI. ListAvailableForDevice serves the user-selection catalog; ListAssignedUserIDsForDevice is the narrow string-list used by device_handler. Non-goals (join-row shapes — defer): - ListAssignedActionsForDevice (returns action data — lives on the action-domain seam) - ListDirectAssignmentsForDevice / ListGroupAssignmentsForDevice (join-row shapes) - ListAssignmentsForUser (different row shape — transitional inline conversion at the one call site for now) Call sites migrated: - assignment_handler.go (Create/Delete/Get/List/Count + assignmentToProto signature) - user_selection_handler.go (ListAvailableAssignmentsForDevice ×2) - device_handler.go (ListDeviceAssignedUserIDs) Closes #279.
c43586f to
3b671cc
Compare
Summary
`AssignmentRepo` closes the action-chain migration (Action #271 → ActionSet #273 → Definition #275 → Execution #277 → Assignment). Branches off main.
Methods
Non-goals (join shapes — defer)
Call sites migrated
Acceptance
Part of #242. Closes #279.
Summary by CodeRabbit