feat: models structs

This commit is contained in:
2024-12-29 23:48:18 +07:00
parent 9a66f2f2a7
commit a7f82bf8f2
7 changed files with 42 additions and 31 deletions

View File

@@ -1,26 +0,0 @@
package models
type Order struct {
Id uint `gorm:"primaryKey"`
Status string
ProductTypeId uint
ProductType ProductType
ProductAmount uint
Description string
CustomerId uint `gorm:"null;foreignKey:CustomerId;"` // want "Null safety error in \"Order\" model, field \"CustomerId\": column nullable policy doesn't match to tag nullable policy"
Customer Customer
CreatedAt int64 `gorm:"autoCreateTime"`
DeadlineDate int64
}
type ProductType struct {
Id uint `gorm:"primaryKey"`
Name string
}
type Customer struct {
Id uint `gorm:"primaryKey"`
Title string
Contact string
Orders []Order `gorm:"foreignKey:CustomerId"`
}