add better logs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// BaseFilter contains common filter fields that can be embedded in other filters
|
||||
type BaseFilter struct {
|
||||
@@ -21,15 +23,6 @@ type ServerBasedFilter struct {
|
||||
ServerID int `param:"id"`
|
||||
}
|
||||
|
||||
// ServerFilter defines filtering options for Server queries
|
||||
type ServerFilter struct {
|
||||
BaseFilter
|
||||
ServerBasedFilter
|
||||
Name string `query:"name"`
|
||||
ServiceName string `query:"service_name"`
|
||||
Status string `query:"status"`
|
||||
}
|
||||
|
||||
// ConfigFilter defines filtering options for Config queries
|
||||
type ConfigFilter struct {
|
||||
BaseFilter
|
||||
|
||||
@@ -3,6 +3,8 @@ package model
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Server represents an ACC server instance
|
||||
@@ -49,4 +51,23 @@ type ServerState struct {
|
||||
SessionDurationMinutes int `json:"sessionDurationMinutes"`
|
||||
// Players map[int]*PlayerState
|
||||
// etc.
|
||||
}
|
||||
|
||||
// ServerFilter defines filtering options for Server queries
|
||||
type ServerFilter struct {
|
||||
BaseFilter
|
||||
ServerBasedFilter
|
||||
Name string `query:"name"`
|
||||
ServiceName string `query:"service_name"`
|
||||
Status string `query:"status"`
|
||||
}
|
||||
|
||||
// ApplyFilter implements the Filterable interface
|
||||
func (f *ServerFilter) ApplyFilter(query *gorm.DB) *gorm.DB {
|
||||
// Apply server filter
|
||||
if f.ServerID != 0 {
|
||||
query = query.Where("id = ?", f.ServerID)
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
// StateHistoryFilter combines common filter capabilities
|
||||
type StateHistoryFilter struct {
|
||||
BaseFilter // Adds pagination and sorting
|
||||
ServerBasedFilter // Adds server ID from path parameter
|
||||
DateRangeFilter // Adds date range filtering
|
||||
|
||||
|
||||
Reference in New Issue
Block a user