shopitems instead rooms
This commit is contained in:
26
models/shopItem.go
Normal file
26
models/shopItem.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user