fix batch: admin login rehash->password_hash mapping (500); geolocation timeout 20s + hide button on approval + 'location shared' notice; sms: link includes typed number (Alpine); location page = found-dog + map + finder number + tag details; nicer closed page; password visibility toggles; product photos; templates use x-text (no {{}} in Alpine)

This commit is contained in:
2026-08-10 12:27:20 +10:00
parent b5db858ef8
commit 9158681001
6 changed files with 70 additions and 26 deletions

View File

@@ -1,11 +1,8 @@
package handlers
import (
"errors"
"net/http"
"github.com/jackc/pgx/v5"
"wherewoof/frontend/internal/db"
)
@@ -16,10 +13,16 @@ type locationData struct {
FinderPhone string
TagCode string
ScannedAt string
ItemType string
Name string
PhotoURL string
Phone string
Address string
}
// ServeShort resolves a short code to its scan and renders the owner's
// location page (map embed + finder details).
// location page: "your item was found here" — map embed + finder details +
// the tag's return details.
func (a *App) ServeShort(w http.ResponseWriter, r *http.Request) {
code := r.PathValue("code")
sc, err := a.Queries.GetShortCode(r.Context(), code)
@@ -36,11 +39,7 @@ func (a *App) ServeShort(w http.ResponseWriter, r *http.Request) {
tag, err := a.Queries.GetTagByID(r.Context(), scan.TagID)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
http.NotFound(w, r)
return
}
http.Error(w, "internal error", http.StatusInternalServerError)
http.NotFound(w, r)
return
}
@@ -50,8 +49,15 @@ func (a *App) ServeShort(w http.ResponseWriter, r *http.Request) {
FinderPhone: scan.ScannerPhone.String,
TagCode: tag.TagCode,
ScannedAt: scan.ScannedAt.Time.Local().Format("Mon 2 Jan, 3:04 pm"),
Name: tag.Description.String,
PhotoURL: tag.PhotoUrl.String,
Phone: tag.Phone.String,
Address: tag.Address.String,
}
a.render(w, r, "location", "Location found", data, "")
if tag.ItemType.Valid {
data.ItemType = titleCase(tag.ItemType.String)
}
a.render(w, r, "location", "Found", data, "")
}
// keep the db import referenced (Tag lookup above uses a.Queries only; this