Files
2026-07-16 22:16:45 +07:00

37 lines
1.3 KiB
Go

package hospital
import (
"time"
"gorm.io/gorm"
"wucher/internal/shared/pkg/uuidv7"
)
type Hospital struct {
ID []byte `gorm:"type:binary(16);primaryKey;column:id"`
Name string `gorm:"type:varchar(128);not null;column:hospital_name"`
SortKey *int `gorm:"column:sortkey"`
Address string `gorm:"type:varchar(256);column:address"`
LandlineNumber string `gorm:"type:varchar(20);column:landline_number"`
MobileNumber string `gorm:"type:varchar(20);column:mobile_number"`
Email string `gorm:"type:varchar(128);column:email"`
Note string `gorm:"type:text;column:note"`
IsActive bool `gorm:"type:tinyint(1);index;not null;default:1;column:is_active"`
CreatedAt time.Time `gorm:"column:created_at"`
CreatedBy []byte `gorm:"type:binary(16);column:created_by"`
UpdatedAt time.Time `gorm:"column:updated_at"`
UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"`
DeletedAt *time.Time `gorm:"column:deleted_at"`
DeletedBy []byte `gorm:"type:binary(16);column:deleted_by"`
}
func (Hospital) TableName() string { return "no_icao_codes" }
func (h *Hospital) BeforeCreate(tx *gorm.DB) error {
if len(h.ID) == 0 {
h.ID = uuidv7.MustBytes()
}
return nil
}