add(backend) Сделано API под корзину

This commit is contained in:
2026-06-22 21:12:48 +03:00
parent 814b93621d
commit a73d147e12
5 changed files with 130 additions and 2 deletions
+16
View File
@@ -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"`
}