upstream sync
This commit is contained in:
@@ -85,7 +85,7 @@ func GetProductTemplate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(productTemplate.Config, &productTemplate.ProductTemplateConfig)
|
||||
err = json.Unmarshal([]byte(productTemplate.Config), &productTemplate.ProductTemplateConfig)
|
||||
if err != nil {
|
||||
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"})
|
||||
|
||||
2
main.go
2
main.go
@@ -48,6 +48,8 @@ func main() {
|
||||
// Add User and Device resources
|
||||
Admin.AddResource(&models.User{})
|
||||
Admin.AddResource(&models.Device{})
|
||||
Admin.AddResource(&models.Buyer{})
|
||||
Admin.AddResource(&models.ProductTemplate{})
|
||||
// Initialize HTTP request multiplexer
|
||||
mux := http.NewServeMux()
|
||||
// Mount admin interface to mux
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type ProductTemplate struct {
|
||||
gorm.Model
|
||||
Name string
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user