Skip to content

Commit f2e37df

Browse files
fix: club relation issue for post modal
1 parent ce62c96 commit f2e37df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/models/post.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ type Post struct {
2828
ViewsCount int `json:"views_count" gorm:"default:0"`
2929
UserID uint `json:"user_id"`
3030
ClubID uint `json:"club_id"`
31+
32+
Club Club `json:"club" gorm:"foreignKey:ClubID"`
3133
User User `json:"user" gorm:"foreignKey:UserID"`
3234
Comments []Comment `json:"comments,omitempty" gorm:"foreignKey:PostID"`
3335
Likes []PostLike `json:"likes,omitempty" gorm:"foreignKey:PostID"`
34-
36+
3537
CreatedAt time.Time `json:"created_at"`
3638
UpdatedAt time.Time `json:"updated_at"`
3739
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`

0 commit comments

Comments
 (0)