added admin page and audit log viewing

This commit is contained in:
2026-02-11 19:07:40 +11:00
parent 2a3f4e4861
commit 4c80165f01
22 changed files with 1298 additions and 155 deletions

View File

@@ -20,8 +20,9 @@ type List[T any] struct {
}
type Filter struct {
Field string
Value any
Field string
Value any
Operator string
}
type ListFilter struct {
@@ -32,8 +33,8 @@ func NewListFilter() *ListFilter {
return &ListFilter{[]Filter{}}
}
func (f *ListFilter) Add(field string, value any) {
f.filters = append(f.filters, Filter{field, value})
func (f *ListFilter) Add(field, operator string, value any) {
f.filters = append(f.filters, Filter{field, value, "="})
}
func GetList[T any](tx bun.Tx) *listgetter[T] {
@@ -62,7 +63,7 @@ func (l *listgetter[T]) Relation(name string, apply ...func(*bun.SelectQuery) *b
func (l *listgetter[T]) Filter(filters ...Filter) *listgetter[T] {
for _, filter := range filters {
l.q = l.q.Where("? = ?", bun.Ident(filter.Field), filter.Value)
l.q = l.q.Where("? ? ?", bun.Ident(filter.Field), bun.Safe(filter.Operator), filter.Value)
}
return l
}