upstream sync
This commit is contained in:
@@ -85,7 +85,7 @@ func GetProductTemplate(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(productTemplate.Config, &productTemplate.ProductTemplateConfig)
|
err = json.Unmarshal([]byte(productTemplate.Config), &productTemplate.ProductTemplateConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("GetProductTemplate Error: Could not fetch product template config: %v", err)
|
log.Printf("GetProductTemplate Error: Could not fetch product template config: %v", err)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Could not fetch product template config"})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Could not fetch product template config"})
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -48,6 +48,8 @@ func main() {
|
|||||||
// Add User and Device resources
|
// Add User and Device resources
|
||||||
Admin.AddResource(&models.User{})
|
Admin.AddResource(&models.User{})
|
||||||
Admin.AddResource(&models.Device{})
|
Admin.AddResource(&models.Device{})
|
||||||
|
Admin.AddResource(&models.Buyer{})
|
||||||
|
Admin.AddResource(&models.ProductTemplate{})
|
||||||
// Initialize HTTP request multiplexer
|
// Initialize HTTP request multiplexer
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
// Mount admin interface to mux
|
// Mount admin interface to mux
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "github.com/jinzhu/gorm"
|
import (
|
||||||
|
"github.com/jinzhu/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
type ProductTemplate struct {
|
type ProductTemplate struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
Name string
|
Name string
|
||||||
ProductTemplateConfig map[string]interface{} `json:",omitempty" sql:"-"`
|
ProductTemplateConfig map[string]interface{} `json:",omitempty" sql:"-"`
|
||||||
Config JSON `json:"-" gorm:"embedded"`
|
Config string `json:"raw_config" gorm:"type:json"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ProductTemplate) Update() (bool, error) {
|
func (ProductTemplate) Update() (bool, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user