added comments
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Post represents a blog post with associated comments and user ID.
|
||||
type Post struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
@ -13,6 +14,8 @@ type Post struct {
|
||||
Comments []Comment
|
||||
UserID uint `gorm:"->;<-:create"`
|
||||
}
|
||||
|
||||
// Comment represents a comment on a post, including its ID, post association, content, and creator.
|
||||
type Comment struct {
|
||||
ID uint
|
||||
PostID uint
|
||||
|
Reference in New Issue
Block a user