I am batman
This commit is contained in:
21
internal/models/taskModel.go
Normal file
21
internal/models/taskModel.go
Normal file
@@ -0,0 +1,21 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user