openspec: frontend-foundation change — proposal, design, specs (4 capabilities), tasks

This commit is contained in:
2026-08-05 12:51:44 +10:00
parent c2d6f00241
commit b846c2c58e
9 changed files with 284 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
## ADDED Requirements
### Requirement: Shared Postgres database
The system SHALL use a single shared PostgreSQL database for all data. The canonical schema SHALL live in `db/schema.sql` until the Laravel admin takes over migration ownership.
#### Scenario: Schema applied to a fresh database
- **WHEN** `db/schema.sql` is applied to an empty database
- **THEN** the `users`, `tags`, and `scans` tables exist with the defined columns and constraints
### Requirement: Users table
The `users` table SHALL store id, unique email, password hash, name, phone, and created_at.
#### Scenario: Unique emails
- **WHEN** a second row is inserted with an email that already exists
- **THEN** the database rejects the insert
### Requirement: Tags table
The `tags` table SHALL store a unique public `tag_code`, owner reference, status (`unset`, `active`, `suspended`), item type, description, photo URL, phone, address, notes, and timestamps.
#### Scenario: Unique tag codes
- **WHEN** a second row is inserted with a tag_code that already exists
- **THEN** the database rejects the insert
#### Scenario: Status values
- **WHEN** a row is inserted with a status not in the allowed set
- **THEN** the database rejects the insert
### Requirement: Scans table
The `scans` table SHALL record tag scans with timestamp, optional latitude/longitude, whether location was shared, optional scanner phone, and whether an alert was sent.
#### Scenario: Recording a scan
- **WHEN** a scan of a tag is recorded
- **THEN** a row exists with tag reference, timestamp, and location flags