Files
OpsMastery.v5/internal/models/taskModel.go
2026-07-12 20:26:16 -04:00

22 lines
696 B
Go

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"`
}