package models import "time" // ActivityLog represents an audit log entry type ActivityLog struct { ID int `json:"id" db:"id"` UserID *int `json:"userId,omitempty" db:"user_id"` TenantID *string `json:"tenantId,omitempty" db:"tenant_id"` Action string `json:"action" db:"action"` ResourceType *string `json:"resourceType,omitempty" db:"resource_type"` ResourceID *string `json:"resourceId,omitempty" db:"resource_id"` Description *string `json:"description,omitempty" db:"description"` Metadata []byte `json:"metadata,omitempty" db:"metadata"` // JSONB IPAddress *string `json:"ipAddress,omitempty" db:"ip_address"` UserAgent *string `json:"userAgent,omitempty" db:"user_agent"` CreatedAt time.Time `json:"createdAt" db:"created_at"` // Joined UserName *string `json:"userName,omitempty"` } // ActivityLogFilter for querying logs type ActivityLogFilter struct { UserID *int TenantID *string Action *string ResourceType *string StartDate *time.Time EndDate *time.Time Limit int Offset int } // ActivityLogStats for dashboard type ActivityLogStats struct { TotalToday int `json:"totalToday"` TotalThisWeek int `json:"totalThisWeek"` TotalThisMonth int `json:"totalThisMonth"` TopActions []ActionCount `json:"topActions"` RecentActivity []ActivityLog `json:"recentActivity"` } type ActionCount struct { Action string `json:"action"` Count int `json:"count"` }