add(backend) Сделано API под корзину
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type CartItem struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
UserID uint `json:"user_id" gorm:"not null;uniqueIndex;idx_user_item"`
|
||||
ItemID uint `json:"item_id" gorm:"not null;uniqueIndex;idx_user_item"`
|
||||
Quantity float64 `json:"quantity" gorm:"not null;default:1"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
Item Item `json:"item" gorm:"foreignKey:ItemID"`
|
||||
}
|
||||
Reference in New Issue
Block a user