feat: add stats page

This commit is contained in:
Krispire Admin
2026-05-31 14:54:15 +05:30
parent d3ad443fde
commit 72f4e6527c
14 changed files with 750 additions and 36 deletions
+28
View File
@@ -0,0 +1,28 @@
package model
import "time"
// Feedback is a user-submitted message — bug report, feature request,
// or general comment — captured by the /feedback page. Surfaced to
// admins both via the /stats page and via an email fan-out on insert.
//
// UserID is a pointer so the model can carry anonymous submissions
// (logged-out visitors) and orphaned rows (the submitter has since
// deleted their account — the FK is set null). ContactEmail is the
// optional reply-to filled in by anonymous submitters.
//
// AuthorHandle / AuthorName / AuthorEmail are populated by joins in
// the repo's lookup helpers (used by the admin email template and the
// /stats page). They're nil for anonymous rows.
type Feedback struct {
ID string `json:"id"`
UserID *string `json:"user_id,omitempty"`
Category string `json:"category"`
Message string `json:"message"`
ContactEmail *string `json:"contact_email,omitempty"`
CreatedAt time.Time `json:"created_at"`
AuthorHandle *string `json:"author_handle,omitempty"`
AuthorName *string `json:"author_name,omitempty"`
AuthorEmail *string `json:"-"` // server-side only; never serialised
}
+8
View File
@@ -25,6 +25,14 @@ type Post struct {
// always false for anonymous viewers (no viewer = no reshare state).
// Drives the post-card "Reshare ↔ Send" swap on the frontend.
ViewerHasReshared bool `json:"viewer_has_reshared"`
// ResharedAt is the timestamp at which the feed owner reshared this
// post. Non-nil only for rows that appear in a profile feed because
// the profile owner reshared them (i.e. the row comes from the
// post_reshares union branch of ListByUser / ListByHandle).
// Authored-by-feed-owner rows leave this nil. Drives the
// "↻ Reshared" badge in the post card.
ResharedAt *time.Time `json:"reshared_at,omitempty"`
}
// PostImage represents one attached image on a post.