// Package models defines the GORM models for spin. Each domain slice adds its // own file (member.go, attendance.go, project.go, incentive.go, accounting.go); // this file holds the shared Base type and the AutoMigrate registry. package models import ( "github.com/google/uuid" "gorm.io/gorm" ) // Base provides a string UUID primary key populated in a BeforeCreate hook. type Base struct { ID string `gorm:"primaryKey" json:"id"` } func (b *Base) ensureID() { if b.ID == "" { b.ID = uuid.NewString() } } // All returns every model for AutoMigrate. Each slice appends its models here. func All() []interface{} { return []interface{}{ // slice 1 — members / org &Member{}, &Department{}, &AuditLog{}, &Notification{}, &WorkStatusEvent{}, &Device{}, // slice 2 — attendance / leave &Attendance{}, &LeaveRequest{}, &OvertimeRequest{}, &WorkPolicy{}, &LeaveBalance{}, // slice 3 — projects &Company{}, &Product{}, &Version{}, &Project{}, &ProjectMember{}, &ClientContact{}, &ProjectTask{}, &Contract{}, &ContractFile{}, &PaymentSplit{}, // slice 4 — incentive &IncentiveConfig{}, &PaymentStage{}, &UserIncentive{}, &QuarterlySettlement{}, // slice 5 — accounting &Account{}, &Transaction{}, &TaxRecord{}, } } var _ = gorm.ErrRecordNotFound // keep gorm imported for slice files