Test
This commit is contained in:
@@ -39,6 +39,10 @@ func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
|
|||||||
router.GET("/translations", handlers.TranslationsHandler)
|
router.GET("/translations", handlers.TranslationsHandler)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// import
|
||||||
|
router.POST("/import", handlers.ImportHandler_PropertyTypesGroup)
|
||||||
|
|
||||||
|
// test endpoint
|
||||||
router.GET("/test", Test)
|
router.GET("/test", Test)
|
||||||
|
|
||||||
// server
|
// server
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
[{
|
||||||
|
"name": "Simply CPQ",
|
||||||
|
"description": "Property Type Group for Simply CPQ",
|
||||||
|
"property_types_groups": [
|
||||||
|
{
|
||||||
|
"name": "electrical",
|
||||||
|
"description": "All electrical property types",
|
||||||
|
"property_types": [
|
||||||
|
{
|
||||||
|
"name": "Spannungsversorgung (V)",
|
||||||
|
"description": "Spannungsversorgung (V)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Leistung (W)",
|
||||||
|
"description": "Leistung"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Eingangsimpedanz (Ω)",
|
||||||
|
"description": "Wiederstand der Eingangsimpedanz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Frequenzbereich (Hz‑kHz)",
|
||||||
|
"description": "Frequenzbereich (Hz‑kHz)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Signal‑Rausch‑Verhältnis (dB)",
|
||||||
|
"description": "Signal‑Rausch‑Verhältnis (dB)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Anschlüsse",
|
||||||
|
"description": "Anschlüsse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ausgangsimpedanz (Ω)",
|
||||||
|
"description": "Ausgangsimpedanz (Ω)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mechanical",
|
||||||
|
"description": "All mechanical properties",
|
||||||
|
"property_types":[
|
||||||
|
{
|
||||||
|
"name": "Abmessungen (mm)",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Gewicht (kg)",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kapazität (kg)",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Programms/Features",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wasserverbrauch pro Zyklus (L)",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Material Innenraum",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
} {
|
||||||
|
"name": "Kapazität/Volumen (L)",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Schleuderdrehzahl (U/min)",
|
||||||
|
"description": "All mechanical properties"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "other",
|
||||||
|
"description": "All other properties",
|
||||||
|
"property_types":[
|
||||||
|
{
|
||||||
|
"name": "Preis (USD)",
|
||||||
|
"description": "All other properties"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Zusatzfunktionen",
|
||||||
|
"description": "All other properties"
|
||||||
|
}, {
|
||||||
|
"name": "Bedienungsart",
|
||||||
|
"description": "All other properties"
|
||||||
|
}, {
|
||||||
|
"name": "Energieeffizienzklasse",
|
||||||
|
"description": "All other properties"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"xcpq_editor/internal/models"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ImportHandler_PropertyTypesGroup(ctx *gin.Context) {
|
||||||
|
// Handle the import request here
|
||||||
|
|
||||||
|
var importData []models.Property_Types_Group
|
||||||
|
if err := ctx.ShouldBindJSON(&importData); err != nil {
|
||||||
|
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.JSON(http.StatusOK, gin.H{
|
||||||
|
"message": "Import successful",
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Property struct {
|
type Property struct {
|
||||||
Id int
|
Id int `json:"id"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Description string
|
Description string `json:"description,omitempty"`
|
||||||
Image_Url string
|
Image_Url string `json:"image_url,omitempty"`
|
||||||
Parent_Property *Property
|
Parent_Property *Property `json:"parent_property,omitempty"`
|
||||||
Values []Value
|
Values []Value `json:"values,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Property_Type struct {
|
type Property_Type struct {
|
||||||
Id int
|
Id int `json:"id"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Description string
|
Description string `json:"description,omitempty"`
|
||||||
Image_Url string
|
Image_Url string `json:"image_url,omitempty"`
|
||||||
Property Property
|
Property Property `json:"property,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Property_Types_Group struct {
|
type Property_Types_Group struct {
|
||||||
Id int
|
Id int `json:"id"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Description string
|
Description string `json:"description,omitempty"`
|
||||||
Image_Url string
|
Image_Url string `json:"image_url,omitempty"`
|
||||||
Property_Types []Property_Type
|
Property_Types []Property_Type `json:"property_types,omitempty"`
|
||||||
Property_Types_Groups []Property_Types_Group
|
Property_Types_Groups []Property_Types_Group `json:"property_types_groups,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Value struct {
|
type Value struct {
|
||||||
Id int
|
Id int `json:"id"`
|
||||||
Value string
|
Value string `json:"value"`
|
||||||
Image_Url string
|
Image_Url string `json:"image_url,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user