refactor:将request结构体写到entity

This commit is contained in:
Leon
2025-12-15 17:32:56 +08:00
parent a1d49f0ab1
commit b53593b920
2 changed files with 10 additions and 10 deletions

View File

@@ -4,7 +4,15 @@ import "time"
type Like struct { type Like struct {
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey"`
VideoID uint `gorm:"index, not null"` VideoID uint `gorm:"index;not null"`
AccountID uint `gorm:"index, not null"` AccountID uint `gorm:"index;not null"`
CreatedAt time.Time CreatedAt time.Time
} }
type LikeRequest struct {
VideoID uint `json:"video_id"`
}
type LikeHandler struct {
service *LikeService
}

View File

@@ -6,14 +6,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
type LikeRequest struct {
VideoID uint `json:"video_id"`
}
type LikeHandler struct {
service *LikeService
}
func NewLikeHandler(service *LikeService) *LikeHandler { func NewLikeHandler(service *LikeService) *LikeHandler {
return &LikeHandler{service: service} return &LikeHandler{service: service}
} }