added comments

This commit is contained in:
u80864958
2025-05-02 10:39:35 +02:00
parent fb7d5a623a
commit 14b57b57e8
16 changed files with 73 additions and 29 deletions

View File

@ -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