feat: add sorting for tables

This commit is contained in:
Elias Schneider
2025-01-11 20:32:22 +01:00
parent 61d18a9d1b
commit fd69830c26
27 changed files with 294 additions and 138 deletions
+5 -5
View File
@@ -9,11 +9,11 @@ import (
type AuditLog struct {
Base
Event AuditLogEvent
IpAddress string
Country string
City string
UserAgent string
Event AuditLogEvent `sortable:"true"`
IpAddress string `sortable:"true"`
Country string `sortable:"true"`
City string `sortable:"true"`
UserAgent string `sortable:"true"`
UserID string
Data AuditLogData
}
+2 -2
View File
@@ -9,8 +9,8 @@ import (
// Base contains common columns for all tables.
type Base struct {
ID string `gorm:"primaryKey;not null"`
CreatedAt model.DateTime
ID string `gorm:"primaryKey;not null"`
CreatedAt model.DateTime `sortable:"true"`
}
func (b *Base) BeforeCreate(_ *gorm.DB) (err error) {
+1 -1
View File
@@ -36,7 +36,7 @@ type OidcAuthorizationCode struct {
type OidcClient struct {
Base
Name string
Name string `sortable:"true"`
Secret string
CallbackURLs CallbackURLs
ImageType *string
+5 -5
View File
@@ -9,11 +9,11 @@ import (
type User struct {
Base
Username string
Email string
FirstName string
LastName string
IsAdmin bool
Username string `sortable:"true"`
Email string `sortable:"true"`
FirstName string `sortable:"true"`
LastName string `sortable:"true"`
IsAdmin bool `sortable:"true"`
CustomClaims []CustomClaim
UserGroups []UserGroup `gorm:"many2many:user_groups_users;"`
+2 -2
View File
@@ -2,8 +2,8 @@ package model
type UserGroup struct {
Base
FriendlyName string
Name string `gorm:"unique"`
FriendlyName string `sortable:"true"`
Name string `gorm:"unique" sortable:"true"`
Users []User `gorm:"many2many:user_groups_users;"`
CustomClaims []CustomClaim
}