openspec: laravel-admin change — Filament admin (users/tags/products/orders/dashboard) on shared Postgres

This commit is contained in:
2026-08-07 20:23:02 +10:00
parent 0ee211d156
commit 224545ac64
11 changed files with 195 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
## ADDED Requirements
### Requirement: Admin login
The system SHALL provide a login for admin users at `/admin/login`. Only users with `is_admin = true` SHALL be able to access the admin panel.
#### Scenario: Admin logs in
- **WHEN** an admin user logs in with valid credentials
- **THEN** they reach the admin dashboard
#### Scenario: Non-admin blocked
- **WHEN** an owner (not admin) tries to access the admin panel
- **THEN** access is denied (403 / redirect)
### Requirement: is_admin flag
The `users` table SHALL have an `is_admin` boolean, default false.
#### Scenario: Promote a user
- **WHEN** an existing user is marked admin
- **THEN** they can log into the admin panel

View File

@@ -0,0 +1,8 @@
## ADDED Requirements
### Requirement: Dashboard stats
The admin dashboard SHALL show operational numbers: tags by status (unset/active/suspended), scans in the last 24 hours, recent scans with tag + owner, and lapsed orders.
#### Scenario: View dashboard
- **WHEN** an admin opens the dashboard
- **THEN** the stats and recent activity are displayed

View File

@@ -0,0 +1,15 @@
## ADDED Requirements
### Requirement: Product CRUD
The admin SHALL create, edit, and list product templates (sku unique, name, item type).
#### Scenario: Create a product
- **WHEN** an admin creates a product with a unique sku and name
- **THEN** it appears in the products list and can be assigned to tags
### Requirement: Order CRUD with lifecycle
The admin SHALL create and edit orders with the status lifecycle `pending → paid → lapsed → cancelled`.
#### Scenario: Advance an order status
- **WHEN** an admin changes an order from pending to paid
- **THEN** the order reflects the paid status

View File

@@ -0,0 +1,22 @@
## ADDED Requirements
### Requirement: List and manage tags
The admin SHALL list all tags (registry + owned), searchable, with status and owner shown.
#### Scenario: Browse tags
- **WHEN** an admin opens the tags list
- **THEN** all tags are shown with owner, status, product/order
### Requirement: Assign product and order
The admin SHALL assign a `product_id` and `order_id` to a tag (the Phase 2.5 linkage).
#### Scenario: Link a tag to a sale
- **WHEN** an admin sets product + order on a tag and saves
- **THEN** the tag row carries both foreign keys
### Requirement: Suspend / unsuspend a tag
The admin SHALL suspend or unsuspend a tag (existing `SetTagStatus` behaviour).
#### Scenario: Suspend a tag
- **WHEN** an admin suspends a tag
- **THEN** the tag page shows unavailable and alerts stop

View File

@@ -0,0 +1,15 @@
## ADDED Requirements
### Requirement: List and view users
The admin SHALL list owner accounts (searchable) and view a user's details: contact info, tags owned, recent scans.
#### Scenario: Find a user
- **WHEN** an admin searches by email/name
- **THEN** matching accounts are listed
### Requirement: Suspend a user
The admin SHALL be able to suspend a user, which prevents new alert SMS for their tags (via existing tag status).
#### Scenario: Suspend then re-enable
- **WHEN** an admin suspends a user and later re-enables them
- **THEN** the state flips accordingly and tag alerts reflect it

View File

@@ -0,0 +1,12 @@
## ADDED Requirements
### Requirement: users.is_admin column
The `users` table SHALL include an `is_admin` boolean column, NOT NULL default FALSE, added idempotently.
#### Scenario: Fresh database
- **WHEN** `db/schema.sql` is applied to an empty database
- **THEN** `users.is_admin` exists defaulting to FALSE
#### Scenario: Existing database
- **WHEN** `db/schema.sql` is re-applied to an existing database
- **THEN** the column is added without error