fixes
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
@@ -17,7 +18,10 @@ type User struct {
|
||||
}
|
||||
|
||||
func (u *User) AfterCreate(tx *gorm.DB) error {
|
||||
return tx.FirstOrCreate(&UserSocialRating{}, UserSocialRating{
|
||||
UserID: u.ID,
|
||||
}).Error
|
||||
rating := UserSocialRating{UserID: u.ID}
|
||||
|
||||
return tx.
|
||||
Omit(clause.Associations).
|
||||
Where("user_id = ?", u.ID).
|
||||
FirstOrCreate(&rating).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user