From 27db7345a238b16507a464a1e7f579d396d7d5d9 Mon Sep 17 00:00:00 2001 From: Suraj Mahto <84609578+surajhub255@users.noreply.github.com> Date: Thu, 18 Jul 2024 04:06:54 +0000 Subject: [PATCH] feat : updated controllers --- controllers/avatar_controller.go | 4 ++-- controllers/collection_controller.go | 4 ++-- controllers/fantoken_controller.go | 4 ++-- controllers/phygital_controller.go | 4 ++-- controllers/users.go | 4 ++-- controllers/variant_controller.go | 4 ++-- controllers/webxr_controller.go | 4 ++-- models/avatar.go | 2 +- models/collection.go | 2 +- models/fantoken.go | 2 +- models/phygital.go | 2 +- models/users.go | 2 +- models/variant.go | 2 +- models/webxr.go | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/controllers/avatar_controller.go b/controllers/avatar_controller.go index 58a84c2..d73b7b4 100644 --- a/controllers/avatar_controller.go +++ b/controllers/avatar_controller.go @@ -50,9 +50,9 @@ func GetAvatarByPhygitalID(c *gin.Context) { // get all avatars api func GetAllAvatars(c *gin.Context) { + chaintypeId := c.Param("chaintype_id") var avatars []models.Avatar - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&avatars).Where("chaintype_id = ?" , chainTypeId).Error; err != nil { + if err := db.DB.Find(&avatars).Where("chaintype_id = ?" , chaintypeId).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/controllers/collection_controller.go b/controllers/collection_controller.go index 7ab6813..17aef06 100644 --- a/controllers/collection_controller.go +++ b/controllers/collection_controller.go @@ -46,8 +46,8 @@ func GetCollectionByBrandId(c *gin.Context) { // get all connection api func GetAllCollections(c *gin.Context) { var collections []models.Collection - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&collections).Where("chaintype_id = ?", chainTypeId).Error; err != nil { + chaintypeId := c.Param("chaintype_id") + if err := db.DB.Find(&collections).Where("chaintype_id = ?", chaintypeId).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/controllers/fantoken_controller.go b/controllers/fantoken_controller.go index c0be2a9..e572dd9 100644 --- a/controllers/fantoken_controller.go +++ b/controllers/fantoken_controller.go @@ -36,8 +36,8 @@ func GetFanToken(c *gin.Context) { func GetAllFanToken(c *gin.Context) { var fantoken []models.FanToken - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&fantoken).Where("chaintype_id = ?",chainTypeId ).Error; err != nil { + chaintypeId := c.Param("chaintype_id") + if err := db.DB.Find(&fantoken).Where("chaintype_id = ?",chaintypeId ).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/controllers/phygital_controller.go b/controllers/phygital_controller.go index d6b91b3..d29ef3f 100644 --- a/controllers/phygital_controller.go +++ b/controllers/phygital_controller.go @@ -40,8 +40,8 @@ func GetPhygital(c *gin.Context) { // get all phygital api func GetAllPhygital(c *gin.Context) { var phygitals []models.Phygital - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&phygitals).Where("chaintype_id = ? " , chainTypeId).Error; err != nil { + chaintypeId := c.Param("chaintype_id") + if err := db.DB.Find(&phygitals).Where("chaintype_id = ? " , chaintypeId).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/controllers/users.go b/controllers/users.go index 97fa9cf..72e75ca 100644 --- a/controllers/users.go +++ b/controllers/users.go @@ -50,8 +50,8 @@ func GetAllUsers(c *gin.Context) { func GetAllUsersByChainType(c *gin.Context) { var users []models.User - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&users).Where("chaintype_id = ? " , chainTypeId).Error; err != nil { + chaintypeId := c.Param("chaintype_id") + if err := db.DB.Find(&users).Where("chaintype_id = ? " , chaintypeId).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/controllers/variant_controller.go b/controllers/variant_controller.go index bc0a477..924ea5c 100644 --- a/controllers/variant_controller.go +++ b/controllers/variant_controller.go @@ -39,8 +39,8 @@ func GetVariant(c *gin.Context) { // get all variant api func GetAllVariant(c *gin.Context) { var variants []models.Variant - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&variants).Where("chaintype_id = ? ", chainTypeId).Error; err != nil { + chaintypeId := c.Param("chaintype_id") + if err := db.DB.Find(&variants).Where("chaintype_id = ? ", chaintypeId).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/controllers/webxr_controller.go b/controllers/webxr_controller.go index 8ddd3e7..3f50eb1 100644 --- a/controllers/webxr_controller.go +++ b/controllers/webxr_controller.go @@ -48,8 +48,8 @@ func GetWebXRByPhygitalID(c *gin.Context) { // get all webxr func GetAllWebXR(c *gin.Context) { var webxr []models.WebXR - chainTypeId := c.Param("chaintype_id") - if err := db.DB.Find(&webxr).Where("chaintype_id = ? ",chainTypeId).Error; err != nil { + chaintypeId := c.Param("chaintype_id") + if err := db.DB.Find(&webxr).Where("chaintype_id = ? ",chaintypeId).Error; err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } diff --git a/models/avatar.go b/models/avatar.go index 92af86d..edf6b89 100644 --- a/models/avatar.go +++ b/models/avatar.go @@ -13,7 +13,7 @@ type Avatar struct { URL string `json:"url"` UserID string `json:"user_id"` PhygitalID string `json:"phygital_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } diff --git a/models/collection.go b/models/collection.go index 7422f0a..978c2d6 100644 --- a/models/collection.go +++ b/models/collection.go @@ -18,7 +18,7 @@ type Collection struct { Tags string `json:"tags"` Status int `json:"status"` BrandID string `json:"brand_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } diff --git a/models/fantoken.go b/models/fantoken.go index 6c6b31a..8580f31 100644 --- a/models/fantoken.go +++ b/models/fantoken.go @@ -11,7 +11,7 @@ type FanToken struct { CollectionID uuid.UUID `json:"collection_id"` PhygitalID string `json:"phygital_id"` FanTokenID string `json:"fantoken_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } diff --git a/models/phygital.go b/models/phygital.go index 4cbdcc3..03becc0 100644 --- a/models/phygital.go +++ b/models/phygital.go @@ -33,7 +33,7 @@ type Phygital struct { ContractAddress string `json:"contract_address"` GraphURL string `json:"graph_url"` CollectionID uuid.UUID `json:"collection_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } diff --git a/models/users.go b/models/users.go index d86a06a..a59d4e2 100644 --- a/models/users.go +++ b/models/users.go @@ -13,7 +13,7 @@ type User struct { WalletAddress string `json:"wallet_address"` Name string `json:"name"` ProfileImage string `json:"profile_image"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } diff --git a/models/variant.go b/models/variant.go index 3a65e99..b2eb832 100644 --- a/models/variant.go +++ b/models/variant.go @@ -12,7 +12,7 @@ type Variant struct { Variant string `json:"variant"` Description string `json:"description"` PhygitalID string `json:"phygital_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } diff --git a/models/webxr.go b/models/webxr.go index 583f0d7..ec17dd4 100644 --- a/models/webxr.go +++ b/models/webxr.go @@ -19,7 +19,7 @@ type WebXR struct { SilverReward string `json:"silver_reward"` BronzeReward string `json:"bronze_reward"` PhygitalID string `json:"phygital_id"` - ChainTypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` + ChaintypeID uuid.UUID `gorm:"type:uuid" json:"chaintype_id"` CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"` UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` }