This commit is contained in:
2026-09-14 08:52:52 +02:00
parent d1e210d03e
commit c62aa67220
9 changed files with 143 additions and 20 deletions
@@ -39,6 +39,10 @@ func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
router.GET("/translations", handlers.TranslationsHandler)
*/
// import
router.POST("/import", handlers.ImportHandler_PropertyTypesGroup)
// test endpoint
router.GET("/test", Test)
// 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
type Property struct {
Id int
Name string
Description string
Image_Url string
Parent_Property *Property
Values []Value
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"`
Parent_Property *Property `json:"parent_property,omitempty"`
Values []Value `json:"values,omitempty"`
}
@@ -1,9 +1,9 @@
package models
type Property_Type struct {
Id int
Name string
Description string
Image_Url string
Property Property
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"`
Property Property `json:"property,omitempty"`
}
@@ -1,10 +1,10 @@
package models
type Property_Types_Group struct {
Id int
Name string
Description string
Image_Url string
Property_Types []Property_Type
Property_Types_Groups []Property_Types_Group
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"`
Property_Types []Property_Type `json:"property_types,omitempty"`
Property_Types_Groups []Property_Types_Group `json:"property_types_groups,omitempty"`
}
@@ -1,7 +1,7 @@
package models
type Value struct {
Id int
Value string
Image_Url string
Id int `json:"id"`
Value string `json:"value"`
Image_Url string `json:"image_url,omitempty"`
}