mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add namespaces, batch ops, and admin logs
This commit is contained in:
11
internal/model/namespace.go
Normal file
11
internal/model/namespace.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
// Namespace represents a logical namespace for public models/bindings.
|
||||
type Namespace struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"size:100;uniqueIndex;not null" json:"name"`
|
||||
Status string `gorm:"size:50;default:'active'" json:"status"`
|
||||
Description string `gorm:"size:255" json:"description"`
|
||||
}
|
||||
18
internal/model/operation_log.go
Normal file
18
internal/model/operation_log.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
// OperationLog stores admin actions for audit.
|
||||
type OperationLog struct {
|
||||
gorm.Model
|
||||
Actor string `gorm:"size:100" json:"actor"`
|
||||
Method string `gorm:"size:10" json:"method"`
|
||||
Path string `gorm:"size:255" json:"path"`
|
||||
Query string `gorm:"size:2048" json:"query"`
|
||||
StatusCode int `json:"status_code"`
|
||||
LatencyMs int64 `json:"latency_ms"`
|
||||
ClientIP string `gorm:"size:64" json:"client_ip"`
|
||||
RequestID string `gorm:"size:64" json:"request_id"`
|
||||
UserAgent string `gorm:"size:255" json:"user_agent"`
|
||||
ErrorMessage string `gorm:"size:1024" json:"error_message"`
|
||||
}
|
||||
Reference in New Issue
Block a user