Compare commits

..

1 Commits

Author SHA1 Message Date
db89056468 Added BeforeSave 2025-10-23 17:02:52 +11:00

View File

@@ -2,6 +2,8 @@ package models
import (
"time"
"gorm.io/gorm"
)
type DBParticipant struct {
@@ -30,3 +32,11 @@ type DBParticipant struct {
func (DBParticipant) TableName() string {
return "gc_participants"
}
func (p *DBParticipant) BeforeSave(tx *gorm.DB) error {
// Convert empty string to nil
if p.UserId != nil && *p.UserId == "" {
p.UserId = nil
}
return nil
}