init push

This commit is contained in:
2026-07-16 22:16:45 +07:00
commit 8b068bdb10
1021 changed files with 332816 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package insurance_patient_data
import (
"time"
"gorm.io/gorm"
"wucher/internal/domain/federal_state"
"wucher/internal/domain/health_insurance_companies"
"wucher/internal/shared/pkg/uuidv7"
)
type InsurancePatientData struct {
ID []byte `gorm:"type:binary(16);primaryKey;column:id"`
HealthInsuranceCompaniesId []byte `gorm:"type:binary(16);index;column:health_insurance_companies_id"`
FederalStateId []byte `gorm:"type:binary(16);index;column:federal_state_id"`
HealthInsuranceCompanies *health_insurance_companies.HealthInsuranceCompany `gorm:"foreignKey:HealthInsuranceCompaniesId;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
FederalState *federal_state.FederalState `gorm:"foreignKey:FederalStateId;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
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 (InsurancePatientData) TableName() string { return "insurance_patient_data" }
func (i *InsurancePatientData) BeforeCreate(tx *gorm.DB) error {
if len(i.ID) == 0 {
i.ID = uuidv7.MustBytes()
}
return nil
}