feat(sessions): workstations table, registration API, and module scaffold #161
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Sub-issue of #125 (Context-Aware Part Subscription System).
Workstations are the foundation for edit sessions, checkpoints, and subscriptions. A workstation represents a specific client installation (Create instance on a particular machine). This issue sets up the module scaffold and workstation CRUD.
1. Module Registration
Register
sessionsas an optional module ininternal/modules/modules.go:2. Database Migration
Create
migrations/022_workstations.sql:fingerprintis a client-generated stable identifier (e.g. hostname + MAC hash or OS machine-id). Uniqueness prevents duplicate registrations.3. Database Layer
Create
internal/db/workstations.go:WorkstationRepositorywith methods:Register(ctx, ws)— upsert on fingerprint (idempotent)ListForUser(ctx, userID)— all workstations for a userGetByID(ctx, id)— single lookupGetByFingerprint(ctx, fingerprint)— lookup by fingerprintTouch(ctx, id)— updatelast_seento now()Delete(ctx, id)— remove (cascades to future sessions/subscriptions)4. API Endpoints
Create
internal/api/workstation_handlers.go:/api/workstations/api/workstations/api/workstations/{id}All routes gated by
RequireModule("sessions").Users can only see/manage their own workstations.
5. Config
Add
SessionsConfigtointernal/config/config.go.Acceptance Criteria
sessionsmodule registered with dependency onauth+dagworkstationstablePOST /api/workstationsregisters idempotently on fingerprintGET /api/workstationsreturns only current user's workstationsDELETE /api/workstations/{id}removes own workstation (403 if not owner)Depends On
None (foundation layer)
Part Of
#125
Admins should be able to see all workstations