openspec: sms-metering-location-link change
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Short URL per alert
|
||||
When an alert SMS is sent with a location, a short code SHALL be created mapping to the scan, and the SMS SHALL contain `https://where-woof.com/s/{code}` as the location link.
|
||||
|
||||
#### Scenario: Alert with location
|
||||
- **WHEN** an alert is sent for a scan with coordinates
|
||||
- **THEN** a short code exists for the scan and the SMS links to it
|
||||
|
||||
### Requirement: Location page
|
||||
`GET /s/{code}` SHALL render the owner's location page: embedded map of the scan's coordinates, the finder's phone if provided, a link to the tag page, and the scan time.
|
||||
|
||||
#### Scenario: Owner opens the link
|
||||
- **WHEN** the owner opens a valid short link
|
||||
- **THEN** the map and finder details are shown
|
||||
|
||||
#### Scenario: Unknown code
|
||||
- **WHEN** the code does not exist
|
||||
- **THEN** a not-found response is returned
|
||||
@@ -0,0 +1,23 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Per-tag SMS credits
|
||||
Each tag SHALL track `sms_allocated`, `sms_used`, and `sms_period_start`. An allocation of 0 SHALL mean unmetered (no credit limit).
|
||||
|
||||
#### Scenario: Allocated plan
|
||||
- **WHEN** an admin sets `sms_allocated = 10` on a tag
|
||||
- **THEN** the tag may send up to 10 SMS in the period
|
||||
|
||||
#### Scenario: Unmetered default
|
||||
- **WHEN** a tag has `sms_allocated = 0`
|
||||
- **THEN** credit checks do not apply (transitional behaviour)
|
||||
|
||||
### Requirement: Credits required to send
|
||||
Before sending an alert or finder-contact SMS on a metered tag, `sms_used < sms_allocated` SHALL hold. Each successful send SHALL increment `sms_used`. When exhausted, scans are recorded but no SMS is sent.
|
||||
|
||||
#### Scenario: Send consumes a credit
|
||||
- **WHEN** an alert SMS is sent on a metered tag
|
||||
- **THEN** `sms_used` increments by one
|
||||
|
||||
#### Scenario: Credits exhausted
|
||||
- **WHEN** `sms_used >= sms_allocated` on a metered tag
|
||||
- **THEN** further scans record but no SMS is sent
|
||||
Reference in New Issue
Block a user