Compare commits

..

No commits in common. "c3ca361506ad0b2c156ebc3646f9d4d6f2ed47bd" and "b547b404106b47b7c5b4ca3fffb3d7028e2b829d" have entirely different histories.

2 changed files with 3 additions and 3 deletions

View File

@ -252,7 +252,7 @@ func GetUserFavoriteWithPagination(ctx context.Context, db *gorm.DB, anthroveUse
for _, userFavorite := range userFavorites {
var post models.Post
err = db.WithContext(ctx).Model(&models.Post{}).Joins("References").Where("id = ?", userFavorite.PostID).First(&post).Error
err = db.WithContext(ctx).Model(&models.Post{}).Where("id = ?", userFavorite.PostID).First(&post).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, &otterError.NoDataFound{}

View File

@ -4,9 +4,9 @@ package models
type Post struct {
BaseModel[AnthrovePostID]
Rating Rating `json:"rating" gorm:"type:enum('safe','questionable','explicit')"`
Tags []Tag `json:"-" gorm:"many2many:post_tags;"`
Tags []Tag `json:"tags" gorm:"many2many:post_tags;"`
Favorites []UserFavorites `json:"-" gorm:"foreignKey:PostID"`
References []PostReference `json:"references" gorm:"foreignKey:PostID"`
References []PostReference `json:"-" gorm:"foreignKey:PostID"`
}
func (Post) TableName() string {