Also accept flexible card-order form values, move mock seed under db/mock, and regenerate Swagger. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package activitylog
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type UserInfo struct {
|
|
Id int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
Role string `json:"role"`
|
|
}
|
|
|
|
type ActivityLogDTO struct {
|
|
Id int64 `json:"id"`
|
|
UserId *int64 `json:"userId"`
|
|
User *UserInfo `json:"user"`
|
|
Method string `json:"method"`
|
|
Path string `json:"path"`
|
|
Module string `json:"module"`
|
|
Action string `json:"action"`
|
|
StatusCode int `json:"statusCode"`
|
|
RequestBody json.RawMessage `json:"requestBody"`
|
|
Ip string `json:"ip"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
}
|
|
|
|
// CreateActivityLogDTO is filled in by the Record middleware for every
|
|
// mutating request made by an authenticated user.
|
|
type CreateActivityLogDTO struct {
|
|
UserId *int64
|
|
Method string
|
|
Path string
|
|
Module string
|
|
Action string
|
|
StatusCode int
|
|
RequestBody []byte
|
|
Ip string
|
|
}
|
|
|
|
type ListFilter struct {
|
|
UserId *int64
|
|
Module string
|
|
Action string
|
|
Page int
|
|
Limit int
|
|
}
|
|
|
|
type ListActivityLogDTO struct {
|
|
Count int64 `json:"count"`
|
|
Logs []ActivityLogDTO `json:"logs"`
|
|
}
|