sarga_updater/bagisto_models/vendor.go

38 lines
1022 B
Go
Raw Normal View History

2023-05-03 08:07:34 +00:00
package bagisto_models
import (
"time"
"gorm.io/gorm"
)
type MarketplaceProduct struct {
ID uint `gorm:"primaryKey"`
CreatedAt time.Time `sql:"DEFAULT:NULL" gorm:"default:null"`
UpdatedAt time.Time `sql:"DEFAULT:NULL" gorm:"default:null"`
ProductID uint
//Product Product
ParentID *uint `sql:"DEFAULT:NULL" gorm:"default:null"`
Condition string `sql:"DEFAULT:NULL" gorm:"default:null"`
Price float64
Description string `sql:"DEFAULT:NULL" gorm:"default:null"`
IsApproved bool `sql:"DEFAULT:NULL" gorm:"default:null"`
IsOwner bool
MarketplaceSellerID uint
MarketplaceSeller MarketplaceSeller
Variants []MarketplaceProduct `gorm:"foreignKey:ParentID"`
}
type MarketplaceSeller struct {
ID uint `gorm:"primaryKey"`
Url string
}
func GetSellers(db *gorm.DB) ([]MarketplaceSeller, error) {
var sellers []MarketplaceSeller
err := db.Model(&MarketplaceSeller{}).Find(&sellers).Error
return sellers, err
}