shopitems instead rooms

This commit is contained in:
2025-03-02 18:49:36 +01:00
parent 48491d0786
commit 6398429c92
11 changed files with 409 additions and 438 deletions

26
models/shopItem.go Normal file
View File

@@ -0,0 +1,26 @@
package models
import (
"gorm.io/gorm"
"github.com/gin-gonic/gin"
)
type ShopItem struct {
gorm.Model
Name string `json:"name" binding:"required" gorm:"unique;not null"`
Description string `json:"description" binding:"required"`
Price float64 `json:"price" binding:"required"`
IsPublic bool `json:"isPublic" gorm:"default:true"`
//Images gin.multipart.FileHeader ``
}
func NewShopItem(ctx *gin.Context) (ShopItem, error) {
var shopItem ShopItem
err := ctx.ShouldBindJSON(&shopItem)
if err != nil {
return ShopItem{}, err
}
return shopItem, nil
}