Setting Consents userid null upon deletion
This commit is contained in:
@@ -16,7 +16,8 @@ type Consent struct {
|
||||
LastName string `gorm:"not null" json:"last_name" binding:"safe_content"`
|
||||
Email string `json:"email" binding:"email,safe_content"`
|
||||
ConsentType string `gorm:"not null" json:"consent_type" binding:"safe_content"`
|
||||
UserID uint `gorm:"not null" json:"user_id"`
|
||||
UserID *uint `json:"user_id"`
|
||||
User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
|
||||
}
|
||||
|
||||
func (c *Consent) BeforeSave(tx *gorm.DB) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user