From d7a120e45e0888a71a0fc96042ef39dc894a0894 Mon Sep 17 00:00:00 2001 From: Suraj Mahto <84609578+surajhub255@users.noreply.github.com> Date: Thu, 18 Jul 2024 03:41:22 +0000 Subject: [PATCH] feat : updated brand_controller --- controllers/brand_controller.go | 4 ++-- models/brand.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/brand_controller.go b/controllers/brand_controller.go index 6ad87a6..9e4c465 100644 --- a/controllers/brand_controller.go +++ b/controllers/brand_controller.go @@ -36,9 +36,9 @@ func GetBrand(c *gin.Context) { // get all brands api func GetAllBrands(c *gin.Context) { + chaintypeId := c.Param("chaintype_id") var brands []models.Brand - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&brands).Where("chaintype_id = ? ", chainTypeId).Error; err != nil { + if err := db.DB.Where("chaintype_id = ?", chaintypeId).Find(&brands).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/models/brand.go b/models/brand.go index 3071aed..eb026d5 100644 --- a/models/brand.go +++ b/models/brand.go @@ -26,7 +26,7 @@ type Brand struct { TradeHub string `json:"trade_hub"` Blockchain string `json:"blockchain"` ChainID string `json:"chain_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` ManagerID string `json:"manager_id"` //user walletaddress CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"`