kra-new/internal/biz/system/media_metadata.go

54 lines
1.3 KiB
Go

package system
import (
"context"
"time"
)
type MediaFile struct {
ID uint
CreatedAt time.Time
UpdatedAt time.Time
Name string
CategoryID int
URL, Tag, Key string
Size int64
Mime, MD5 string
UserID uint
}
type MediaFilter struct {
Page, PageSize int
Keyword string
CategoryID int
Tag string
UserID uint
StartCreatedAt time.Time
EndCreatedAt time.Time
OrderKey string
Desc bool
}
type AttachmentCategory struct {
ID uint
CreatedAt time.Time
UpdatedAt time.Time
Name string
ParentID uint
Children []*AttachmentCategory
}
type MediaMetadataRepo interface {
CreateMedia(context.Context, *MediaFile) error
FindMedia(context.Context, uint) (*MediaFile, error)
FindMediaByHash(context.Context, uint, string) (*MediaFile, error)
ListMedia(context.Context, MediaFilter) ([]*MediaFile, int64, error)
UpdateMediaName(context.Context, uint, string) error
DeleteMedia(context.Context, uint) error
MediaKeyReferences(context.Context, string) (int64, error)
CreateMediaBatch(context.Context, []*MediaFile) error
SaveCategory(context.Context, *AttachmentCategory) error
DeleteCategory(context.Context, uint) error
ListCategories(context.Context) ([]*AttachmentCategory, error)
}