add api framework
Some checks failed
CI / test-build (push) Failing after 59s

This commit is contained in:
2025-12-14 22:15:56 +07:00
parent f4683eeb73
commit a6da313dfc
13 changed files with 915 additions and 84 deletions

36
internal/models/auth.go Normal file
View File

@@ -0,0 +1,36 @@
package models
import "time"
// Role represents a user role
type Role string
const (
RoleAdministrator Role = "administrator"
RoleOperator Role = "operator"
RoleViewer Role = "viewer"
)
// User represents a system user
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Email string `json:"email,omitempty"`
Role Role `json:"role"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// AuditLog represents an audit log entry
type AuditLog struct {
ID string `json:"id"`
Actor string `json:"actor"` // user ID or system
Action string `json:"action"` // "pool.create", "share.delete", etc.
Resource string `json:"resource"` // resource type and ID
Result string `json:"result"` // "success", "failure"
Message string `json:"message,omitempty"`
IP string `json:"ip,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
Timestamp time.Time `json:"timestamp"`
}