1.4 KiB
1.4 KiB
1. Schema & Queries
- 1.1
db/schema.sql: idempotent ALTERstags.sms_allocated/used/period_start;url_shortenedtable;make db-up - 1.2
queries.sql:InsertShortCode,GetShortCode(:one),GetScanByID(:one),AddSmsUsed(:exec,sms_used = sms_used + 1);make generate; build
2. Metering
- 2.1
scan.goshouldAlert: credit check (SmsAllocated > 0 && SmsUsed >= SmsAllocated→ false); after successful alert send →AddSmsUsed - 2.2
FinderContact: same credit check + increment on successful send
3. Location Link
- 3.1 Short-code generator +
InsertShortCodeat alert time (when location present);alertMessageuseswhere-woof.com/s/{code} - 3.2
ServeShorthandler (GET /s/{code}→ scan → location page);location.htmltemplate (map iframe + finder phone + tag link + time); register route + template set
4. Admin
- 4.1 TagResource:
sms_allocated(numeric, editable),sms_used(view),sms_period_start(view)
5. Verification
- 5.1 New suite: metered tag with credits → alert + credit consumed; exhausted → no alert (scan recorded); unmetered (0) → alerts; alert SMS contains
where-woof.com/s/; short link → location page 200 with map + finder details; unknown code → not found - 5.2 Regressions (22+19+12+6) green; deploy frontend + admin; live check
- 5.3
openspec validate sms-metering-location-link; commit