package models import ( "gorm.io/gorm" ) type TaskSection struct { gorm.Model Title string `gorm:"not null" json:"title"` Position int `gorm:"not null;default:0" json:"position"` Tasks []Tasks `gorm:"foreignKey:SectionID;references:ID;constraint:OnDelete:CASCADE;" json:"tasks,omitempty"` } type Tasks struct { gorm.Model Title string `gorm:"not null" json:"title"` Description string `json:"description"` Position int `gorm:"not null;default:0" json:"position"` SectionID uint `gorm:"index" json:"section_id"` Section TaskSection `gorm:"foreignKey:SectionID;references:ID;constraint:OnDelete:CASCADE;" json:"section,omitempty"` }