feat: url dashboard
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// AdminShortURL is a row in the admin short-URL table (a projection of
|
||||
// shortened_urls served only to admins).
|
||||
type AdminShortURL struct {
|
||||
ID int64 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
LongURL string `json:"long_url"`
|
||||
ContentType string `json:"content_type"`
|
||||
ClickCount int64 `json:"click_count"`
|
||||
HumanClickCount int64 `json:"human_click_count"`
|
||||
Disabled bool `json:"disabled"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// ShortURLRangeStat is the (created, clicks) pair for one time window.
|
||||
type ShortURLRangeStat struct {
|
||||
Created int64 `json:"created"` // short URLs created in the window
|
||||
Clicks int64 `json:"clicks"` // clicks recorded in the window
|
||||
}
|
||||
|
||||
// ShortURLStats is the admin dashboard's short-URL summary: fixed today/week/
|
||||
// month windows, all-time totals, and an optional custom range.
|
||||
type ShortURLStats struct {
|
||||
Today ShortURLRangeStat `json:"today"`
|
||||
Week ShortURLRangeStat `json:"week"`
|
||||
Month ShortURLRangeStat `json:"month"`
|
||||
TotalURLs int64 `json:"total_urls"`
|
||||
TotalClicks int64 `json:"total_clicks"`
|
||||
Range *ShortURLRangeStat `json:"range,omitempty"` // present only when from/to given
|
||||
}
|
||||
Reference in New Issue
Block a user