gorm model fixes

This commit is contained in:
Alex
2025-05-20 12:41:21 +02:00
parent 20a693a80c
commit 9d25fa005c
5 changed files with 11 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ type Consent struct {
Email string `json:"email" binding:"email,safe_content"`
ConsentType string `gorm:"not null" json:"consent_type" binding:"safe_content"`
UserID *uint `json:"user_id"`
User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-" binding:"-"`
}
func (c *Consent) BeforeSave(tx *gorm.DB) (err error) {