Add backups, currencies and dashboard APIs, and scope access by guard_name.
Web users may only CRUD their own records, operators stay in assigned branches, and admin/manager/superadmin keep full access. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0d000f9af6
commit
28509eb4ca
65 files changed
+9132
-296
No files matched your search
@@ -0,0 +1,78 @@
|
||||
package dashboard
|
||||
|
||||
import "time"
|
||||
|
||||
// StatMetricDTO is a single KPI card: a running total plus the percent
|
||||
// change of new records this calendar month-to-date versus the same
|
||||
// elapsed window last month. ChangePercent is nil when last month's
|
||||
// window has zero records, since a percent change against zero is
|
||||
// undefined.
|
||||
type StatMetricDTO struct {
|
||||
Count int64 `json:"count"`
|
||||
ChangePercent *float64 `json:"changePercent"`
|
||||
}
|
||||
|
||||
type StatsDTO struct {
|
||||
LoanOrders StatMetricDTO `json:"loanOrders"`
|
||||
ActiveCards StatMetricDTO `json:"activeCards"`
|
||||
ActiveCustomers StatMetricDTO `json:"activeCustomers"`
|
||||
OnlinePayments StatMetricDTO `json:"onlinePayments"`
|
||||
}
|
||||
|
||||
type TrendPointDTO struct {
|
||||
Month int `json:"month"`
|
||||
Loans int64 `json:"loans"`
|
||||
Cards int64 `json:"cards"`
|
||||
}
|
||||
|
||||
type TrendDTO struct {
|
||||
Year int `json:"year"`
|
||||
Points []TrendPointDTO `json:"points"`
|
||||
}
|
||||
|
||||
// LoanStatusShareDTO buckets loan_orders.status into one of five
|
||||
// normalized states so the UI can render a stable donut chart regardless
|
||||
// of the raw status text stored on the row.
|
||||
type LoanStatusShareDTO struct {
|
||||
Status string `json:"status"`
|
||||
Count int64 `json:"count"`
|
||||
Percent float64 `json:"percent"`
|
||||
}
|
||||
|
||||
const (
|
||||
LoanStatusSatisfied = "satisfied"
|
||||
LoanStatusPending = "pending"
|
||||
LoanStatusProcessing = "processing"
|
||||
LoanStatusCancelled = "cancelled"
|
||||
LoanStatusRegistered = "registered"
|
||||
)
|
||||
|
||||
type WeeklyPointDTO struct {
|
||||
Date string `json:"date"`
|
||||
Weekday int `json:"weekday"`
|
||||
Loans int64 `json:"loans"`
|
||||
Cards int64 `json:"cards"`
|
||||
}
|
||||
|
||||
type RecentActivityDTO struct {
|
||||
Id int64 `json:"id"`
|
||||
UniqueId *string `json:"uniqueId"`
|
||||
CustomerName string `json:"customerName"`
|
||||
Amount *string `json:"amount"`
|
||||
Status *string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type OverviewDTO struct {
|
||||
Stats StatsDTO `json:"stats"`
|
||||
Trend TrendDTO `json:"trend"`
|
||||
LoanStatus []LoanStatusShareDTO `json:"loanStatus"`
|
||||
WeeklyOrders []WeeklyPointDTO `json:"weeklyOrders"`
|
||||
RecentActivity []RecentActivityDTO `json:"recentActivity"`
|
||||
}
|
||||
|
||||
type OverviewFilter struct {
|
||||
BranchIds []int64
|
||||
Year int
|
||||
RecentLimit int
|
||||
}
|
||||
Reference in new issue
Block a user