feat: add sorting for tables

This commit is contained in:
Elias Schneider
2025-01-11 20:14:12 +01:00
parent 61d18a9d1b
commit fd69830c26
27 changed files with 294 additions and 138 deletions

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
}

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) {

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

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;"`

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
}