mirror of
https://github.com/MADTeacher/go_basics.git
synced 2025-11-23 21:34:47 +02:00
Глава 8
Допричесать игру
This commit is contained in:
17
part_8/8.4/golang/todo-service/db/models.go
Normal file
17
part_8/8.4/golang/todo-service/db/models.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package db
|
||||
|
||||
type Project struct {
|
||||
ID int `json:"id" gorm:"primary_key;autoIncrement:true;not null"`
|
||||
Name string `json:"name" gorm:"unique;not null"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
ID int `json:"id" gorm:"primary_key;autoIncrement;not null"`
|
||||
Name string `json:"name" gorm:"not null"`
|
||||
Description string `json:"description" gorm:"not null"`
|
||||
Priority uint8 `json:"priority" gorm:"not null"`
|
||||
IsDone bool `json:"isDone" gorm:"not null"`
|
||||
ProjectID int `json:"projectID" gorm:"not null"`
|
||||
Project *Project `gorm:"foreignKey:ProjectID;references:ID"`
|
||||
}
|
||||
Reference in New Issue
Block a user