wip itemvariant

This commit is contained in:
2025-03-04 16:42:59 +01:00
parent d24dfdf262
commit a65ba9c98c
9 changed files with 116 additions and 20 deletions

View File

@@ -4,14 +4,34 @@ import (
"gorm.io/gorm"
)
/*
Sticker
- name, abstr, descr, price, tag
Poster
- name, abstr, descr, price bw/colored, tag
Zines
- name, abstr, descr, price bw/colored/coloredcoveronly, tag
Books
- name, abstr, descr, price, tag
*/
type ItemVariant struct {
gorm.Model
Name string `json:"name" gorm:"not null"`
Price float64 `json:"price" gorm:"not null"`
InStock bool `json:"inStock" gorm:"default:true"`
ShopItemID uint
}
type ShopItem struct {
gorm.Model
Name string `json:"name" binding:"required" gorm:"unique;not null"`
Abstract string `json:"Abstract" binding:"required"`
Description string `json:"description" binding:"required"`
Price float64 `json:"price" binding:"required"`
Category string `json:"category"`
Variants []ItemVariant `json:"variant"`
BasePrice float64 `json:"basePrice"`
IsPublic bool `json:"isPublic" gorm:"default:true"`
Tags []Tag `gorm:"many2many:item_tags;"`
Image string
}