mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-04 00:06:22 +00:00
⚡ add like functionality with Like model, implement like/unlike methods, and update Post and Comment models to track like counts
This commit is contained in:
8
internal/dto/label.go
Normal file
8
internal/dto/label.go
Normal file
@ -0,0 +1,8 @@
|
||||
package dto
|
||||
|
||||
type LabelDto struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Color string `json:"color"`
|
||||
TailwindClassName string `json:"tailwind_class_name"`
|
||||
}
|
16
internal/dto/post.go
Normal file
16
internal/dto/post.go
Normal file
@ -0,0 +1,16 @@
|
||||
package dto
|
||||
|
||||
type PostDto struct {
|
||||
UserID uint `json:"user_id"` // 发布者的用户ID
|
||||
Title string `json:"title"` // 帖子标题
|
||||
Content string `json:"content"`
|
||||
Labels []LabelDto `json:"labels"` // 关联的标签
|
||||
IsPrivate bool `json:"is_private"` // 是否为私密帖子
|
||||
}
|
||||
|
||||
type CreatePostReq struct {
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
Labels []LabelDto `json:"labels"`
|
||||
IsPrivate bool `json:"is_private"`
|
||||
}
|
Reference in New Issue
Block a user