refactor:将request结构体写到entity,并为video添加username字段

This commit is contained in:
Leon
2025-12-15 17:34:01 +08:00
parent b53593b920
commit 9713a23e7b
2 changed files with 33 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ import "time"
type Video struct {
ID uint `gorm:"primaryKey"`
AuthorID uint `gorm:"index;not null"`
Username string `gorm:"type:varchar(255);not null"`
Title string `gorm:"type:varchar(255);not null"`
Description string `gorm:"type:varchar(255);"`
PlayURL string `gorm:"type:varchar(255);not null"`
@@ -12,3 +13,23 @@ type Video struct {
CreateTime time.Time `gorm:"autoCreateTime"`
LikesCount int64 `gorm:"column:likes_count;not null;default:0" json:"likes_count"`
}
type PublishVideoRequest struct {
Title string `json:"title"`
Description string `json:"description"`
PlayURL string `json:"play_url"`
CoverURL string `json:"cover_url"`
}
type ListByAuthorIDRequest struct {
AuthorID uint `json:"author_id"`
}
type GetDetailRequest struct {
ID uint `json:"id"`
}
type UpdateLikesCountRequest struct {
ID uint `json:"id"`
LikesCount int64 `json:"likes_count"`
}