Skip to content

Commit

Permalink
feat : updated controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
surajhub255 committed Jul 18, 2024
1 parent d7a120e commit 27db734
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions controllers/avatar_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/collection_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/fantoken_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/phygital_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/variant_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/webxr_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion models/avatar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion models/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion models/fantoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion models/phygital.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion models/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion models/variant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion models/webxr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down

0 comments on commit 27db734

Please sign in to comment.