Skip to content

Police Admin #290

@naasanov

Description

@naasanov

Motivation

Since police authentication is moving more towards the police side, CHPD wants a way to manage the accounts that they have with the system. This will involve adding a police admin role for police accounts, and giving them a separate table page to manage police accounts.

Completion Criteria

Database

  • role enum (officer, police_admin) added to the Police table

Backend - Pydantic / DTOs

  • Police Account DTO and Update Police Account DTO includes role field
  • Police access token payload carries role as "officer" or "police_admin" instead of the old "police" literal

Backend - Routes

  • PUT /police/{police_id} accepts and persists role changes
  • GET /police implemented with List Query Params, police_admin role required
  • GET /police/csv implemented, returns Excel file stream, police_admin role required
  • All existing police routes updated to accept officer or police_admin role (previously checked for a single police role)

Frontend — Police Admin Dashboard Page

  • New dashboard page created at the appropriate route
  • Accounts table renders with Email and Role columns
  • Role displayed as "Officer" or "Police Admin" (not raw enum values)
  • All table functions operational (Edit, delete, full table search, server-side pagination/filter/sort, Excel export)
  • A police admin cannot delete their own account
  • No "New Account" button present (fully handled by auth)
  • Uses TableTemplate

Frontend — Admin Dashboard

  • Accounts table Role column displays officer or police_admin for police rows
  • Edit police account sidebar includes Role field with officer / police_admin options

Frontend - Auth & Routing

  • Next.js route guard on the Police Admin dashboard page rejects officer role users
  • Access token role field (officer / police_admin) correctly parsed and stored in session
  • Police login flow passes the correct role through to the session after token exchange

Important Notes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions