Alex Dunmow 8b8afc044d Classify personal data deterministically and cover site data tables in check 33 (ADR 0007)
A factory spec's personal flags come from Scout. For a factory-generated
plugin, names, sample shapes, visitor form fields and migration columns
now mark personal data too, and the stricter result applies. A public
route that reads a site data table, or personal plugin settings, fails
check 33. frontend.go, plugin_egress.go, plugin_html.go and
plugin_routes.go carry the lint autofixes check 3 applies to this repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:23:10 +08:00

46 lines
1.1 KiB
Go

package main
import (
"encoding/json"
"log/slog"
"net/http"
"git.dev.alexdunmow.com/block/pluginsdk/plugin"
"git.dev.alexdunmow.com/block/pluginsdk/route"
)
const pluginName = "callbacks-77c1d0"
// Registration is the plugin entry registration.
var Registration = plugin.PluginRegistration{
Name: pluginName,
Version: "1.0.0",
HTTPHandler: newHTTPHandler,
}
const listRecent = `-- name: ListRecentCallers :many
SELECT id, mobile FROM callers ORDER BY id LIMIT 20
`
type Queries struct{}
func (Queries) ListRecentCallers() []string { return nil }
func newHTTPHandler(deps plugin.CoreServices) http.Handler {
r := route.New(pluginName)
r.Form("/request", handleRequest)
r.Handle(http.MethodGet, "/recent", route.Public, handleRecent)
return r
}
func handleRequest(w http.ResponseWriter, r *http.Request) {
email := r.PostFormValue("email")
notes := r.PostFormValue("notes")
slog.Info("call-back requested", "email", email, "notes", notes)
w.WriteHeader(http.StatusNoContent)
}
func handleRecent(w http.ResponseWriter, r *http.Request) {
_ = json.NewEncoder(w).Encode(Queries{}.ListRecentCallers())
}