chore: seed migration objects batch 5
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2026 HotGo
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type ImFileListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
FileId int64 `json:"fileId" dc:"文件ID"`
|
||||
UserId int64 `json:"userId" dc:"上传用户ID"`
|
||||
Status *int `json:"status" dc:"状态"`
|
||||
Purpose string `json:"purpose" dc:"用途"`
|
||||
MimeType string `json:"mimeType" dc:"MIME类型"`
|
||||
Topic string `json:"topic" dc:"关联Topic"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt []*gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
func (in *ImFileListInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
Id int64 `json:"id" dc:"文件ID"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
UserId int64 `json:"userId" dc:"上传用户ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
MimeType string `json:"mimeType" dc:"MIME类型"`
|
||||
Size int64 `json:"size" dc:"大小"`
|
||||
Etag string `json:"etag" dc:"ETag"`
|
||||
Location string `json:"location" dc:"文件位置"`
|
||||
Purpose string `json:"purpose" dc:"用途"`
|
||||
LinkCount int `json:"linkCount" dc:"引用数"`
|
||||
FirstTopic string `json:"firstTopic" dc:"首个关联Topic"`
|
||||
FirstMsgId int64 `json:"firstMsgId" dc:"首个关联消息ID"`
|
||||
FirstLinkAt *gtime.Time `json:"firstLinkAt" dc:"首个关联时间"`
|
||||
}
|
||||
|
||||
type ImFileViewInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Id int64 `json:"id" v:"required#文件ID不能为空" dc:"文件ID"`
|
||||
}
|
||||
|
||||
func (in *ImFileViewInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Id <= 0 {
|
||||
return gerror.New("文件ID不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileViewModel struct {
|
||||
ImFileListModel
|
||||
Links []*ImFileLinkModel `json:"links" dc:"引用列表"`
|
||||
}
|
||||
|
||||
type ImFileLinkModel struct {
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
FileId int64 `json:"fileId" dc:"文件ID"`
|
||||
MsgId int64 `json:"msgId" dc:"消息ID"`
|
||||
Topic string `json:"topic" dc:"Topic"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
}
|
||||
|
||||
type ImFileActionInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Id int64 `json:"id" v:"required#文件ID不能为空" dc:"文件ID"`
|
||||
Reason string `json:"reason" dc:"原因"`
|
||||
}
|
||||
|
||||
func (in *ImFileActionInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Id <= 0 {
|
||||
return gerror.New("文件ID不能为空")
|
||||
}
|
||||
if len([]rune(in.Reason)) > 200 {
|
||||
return gerror.New("原因不能超过200个字符")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileCleanupOrphanInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Days int `json:"days" dc:"保留天数"`
|
||||
Limit int `json:"limit" dc:"处理上限"`
|
||||
}
|
||||
|
||||
func (in *ImFileCleanupOrphanInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Days <= 0 {
|
||||
in.Days = 7
|
||||
}
|
||||
if in.Limit <= 0 {
|
||||
in.Limit = 100
|
||||
}
|
||||
if in.Limit > 1000 {
|
||||
return gerror.New("单次清理上限不能超过1000")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileCleanupOrphanModel struct {
|
||||
Count int `json:"count" dc:"标记数量"`
|
||||
Locations []string `json:"locations" dc:"待物理清理位置"`
|
||||
}
|
||||
Reference in New Issue
Block a user