Property Import

This commit is contained in:
2026-09-14 21:15:09 +02:00
parent a7ef4e52ca
commit 25b3923427
18 changed files with 832 additions and 250 deletions
+15
View File
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}
@@ -1,206 +1,206 @@
[ [
{ {
"label": "X-CPQ", "name": "X-CPQ",
"description": "Property Type Group for X-CPQ", "description": "Property Type Group for X-CPQ",
"propertyTypeGroups": [ "property_type_Groups": [
{ {
"label": "electrical", "name": "electrical",
"description": "All electrical property types", "description": "All electrical property types",
"propertyTypes": [ "property_types": [
{ {
"label": "Spannungsversorgung (V)", "name": "Spannungsversorgung (V)",
"description": "Spannungsversorgung (V)", "description": "Spannungsversorgung (V)",
"values": [ "values": [
220, { "value": 220 },
230 { "value": 230 }
] ]
}, },
{ {
"label": "Leistung (W)", "name": "Leistung (W)",
"description": "Leistung", "description": "Leistung",
"values": [ "values": [
0, { "value": 0 },
140, { "value": 140 },
130, { "value": 130 },
120, { "value": 120 },
110, { "value": 110 },
100, { "value": 100 },
90, { "value": 90 },
80, { "value": 80 },
70, { "value": 70 },
60, { "value": 60 },
50, { "value": 50 },
28, { "value": 28 },
26, { "value": 26 },
24, { "value": 24 },
22, { "value": 22 },
20 { "value": 20 }
] ]
}, },
{ {
"label": "Eingangsimpedanz (Ω)", "name": "Eingangsimpedanz (Ω)",
"description": "Wiederstand der Eingangsimpedanz", "description": "Wiederstand der Eingangsimpedanz",
"values": [ "values": [
10 { "value": 10 }
] ]
}, },
{ {
"label": "Frequenzbereich (Hz‑kHz)", "name": "Frequenzbereich (Hz‑kHz)",
"description": "Frequenzbereich (Hz‑kHz)", "description": "Frequenzbereich (Hz‑kHz)",
"values": [ "values": [
"87‑108" { "value": "87‑108" }
] ]
}, },
{ {
"label": "Signal‑Rausch‑Verhältnis (dB)", "name": "Signal‑Rausch‑Verhältnis (dB)",
"description": "Signal‑Rausch‑Verhältnis (dB)", "description": "Signal‑Rausch‑Verhältnis (dB)",
"values": [ "values": [
48, { "value": 48 },
46, { "value": 46 },
47, { "value": 47 },
45, { "value": 45 },
49, { "value": 49 },
44 { "value": 44 }
] ]
}, },
{ {
"label": "Anschlüsse", "name": "Anschlüsse",
"description": "Anschlüsse", "description": "Anschlüsse",
"values": [ "values": [
"UKW+Bluetooth+DL", { "value": "UKW+Bluetooth+DL" },
"UKW+Wi‑Fi+DL", { "value": "UKW+Wi‑Fi+DL" },
"UKW+DL+Bluetooth", { "value": "UKW+DL+Bluetooth" },
"UKW+Bluetooth+Wi‑Fi", { "value": "UKW+Bluetooth+Wi‑Fi" },
"UKW+Wi‑Fi+DL", { "value": "UKW+Wi‑Fi+DL" },
"UKW+Wi‑Fi", { "value": "UKW+Wi‑Fi" },
"UKW+Bluetooth", { "value": "UKW+Bluetooth" },
"UKW+DL", { "value": "UKW+DL" },
"UKW" { "value": "UKW" }
] ]
}, },
{ {
"label": "Ausgangsimpedanz (Ω)", "name": "Ausgangsimpedanz (Ω)",
"description": "Ausgangsimpedanz (Ω)", "description": "Ausgangsimpedanz (Ω)",
"values": [ "values": [
75 { "value": 75 }
] ]
} }
] ]
}, },
{ {
"label": "mechanical", "name": "mechanical",
"description": "All mechanical properties", "description": "All mechanical properties",
"propertyTypes": [ "property_types": [
{ {
"label": "Abmessungen (mm)", "name": "Abmessungen (mm)",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [ "values": [
"158x88x33", { "value": "158x88x33" },
"310x210x110", { "value": "310x210x110" },
"160x90x35", { "value": "160x90x35" },
"170x100x42", { "value": "170x100x42" },
"150x80x30", { "value": "150x80x30" },
"155x85x32", { "value": "155x85x32" },
"165x95x38", { "value": "165x95x38" },
"305x205x105", { "value": "305x205x105" },
"172x102x44", { "value": "172x102x44" },
"340x240x140", { "value": "340x240x140" },
"420x320x140", { "value": "420x320x140" },
"162x92x36", { "value": "162x92x36" },
"300x200x100", { "value": "300x200x100" },
"168x98x40", { "value": "168x98x40" },
"315x215x115", { "value": "315x215x115" },
"325x225x125", { "value": "325x225x125" },
"415x315x135", { "value": "415x315x135" },
"320x220x120", { "value": "320x220x120" },
"335x235x135", { "value": "335x235x135" },
"330x230x130", { "value": "330x230x130" },
"400x300x120", { "value": "400x300x120" },
"405x305x125", { "value": "405x305x125" },
"345x245x145", { "value": "345x245x145" },
"295x245x135", { "value": "295x245x135" },
"410x310x130", { "value": "410x310x130" },
"290x240x130", { "value": "290x240x130" },
"285x235x125", { "value": "285x235x125" },
"280x230x120", { "value": "280x230x120" },
"275x225x115", { "value": "275x225x115" },
"270x220x110", { "value": "270x220x110" },
"265x215x105", { "value": "265x215x105" },
"255x205x95", { "value": "255x205x95" },
"260x210x100", { "value": "260x210x100" },
"250x200x90", { "value": "250x200x90" },
"445x345x165", { "value": "445x345x165" },
"440x340x160", { "value": "440x340x160" },
"435x335x155", { "value": "435x335x155" },
"430x330x150", { "value": "430x330x150" },
"425x325x145" { "value": "425x325x145" }
] ]
}, },
{ {
"label": "Gewicht (kg)", "name": "Gewicht (kg)",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [ "values": [
3, { "value": 3 },
6, { "value": 6 },
4, { "value": 4 },
2 { "value": 2 }
] ]
}, },
{ {
"label": "Kapazität (kg)", "name": "Kapazität (kg)",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [ "values": [
0 { "value": 0 }
] ]
}, },
{ {
"label": "Programms/Features", "name": "Programms/Features",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [] "values": []
}, },
{ {
"label": "Wasserverbrauch pro Zyklus (L)", "name": "Wasserverbrauch pro Zyklus (L)",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [] "values": []
}, },
{ {
"label": "Material Innenraum", "name": "Material Innenraum",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [] "values": []
}, },
{ {
"label": "Kapazität/Volumen (L)", "name": "Kapazität/Volumen (L)",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [] "values": []
}, },
{ {
"label": "Schleuderdrehzahl (U/min)", "name": "Schleuderdrehzahl (U/min)",
"description": "All mechanical properties", "description": "All mechanical properties",
"values": [] "values": []
} }
] ]
}, },
{ {
"label": "other", "name": "other",
"description": "All other properties", "description": "All other properties",
"propertyTypes": [ "property_types": [
{ {
"label": "Preis (USD)", "name": "Preis (USD)",
"description": "All other properties", "description": "All other properties",
"values": [] "values": []
}, },
{ {
"label": "Zusatzfunktionen", "name": "Zusatzfunktionen",
"description": "All other properties", "description": "All other properties",
"values": [] "values": []
}, },
{ {
"label": "Bedienungsart", "name": "Bedienungsart",
"description": "All other properties", "description": "All other properties",
"values": [] "values": []
}, },
{ {
"label": "Energieeffizienzklasse", "name": "Energieeffizienzklasse",
"description": "All other properties", "description": "All other properties",
"values": [] "values": []
} }
+2 -2
View File
@@ -4,8 +4,8 @@
# password=<databaseUserPassword> dbname=<databaseName> # password=<databaseUserPassword> dbname=<databaseName>
[database] [database]
##connection_string = "host=192.168.178.50 port=5432 user=tsindt password=XD14ko8d dbname=xcpq sslmode=disable" connection_string = "host=192.168.178.50 port=5432 user=tsindt password=XD14ko8d dbname=xcpq sslmode=disable"
connection_string = "host=localhost port=5432 user=tsindt password=XD14ko8d dbname=xcpq sslmode=disable" ##connection_string = "host=localhost port=5432 user=tsindt password=XD14ko8d dbname=xcpq sslmode=disable"
driver_name = "postgres" driver_name = "postgres"
################################################################ ################################################################
@@ -5,6 +5,8 @@ import (
"log" "log"
"net/http" "net/http"
"xcpq_editor/internal/handlers" "xcpq_editor/internal/handlers"
"xcpq_editor/internal/repositories"
"xcpq_editor/internal/services"
"github.com/gin-contrib/cors" "github.com/gin-contrib/cors"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@@ -12,18 +14,33 @@ import (
) )
type HttpServer struct { type HttpServer struct {
config *viper.Viper config *viper.Viper
router *gin.Engine router *gin.Engine
dbHandler *sql.DB dbHandler *sql.DB
importHandler *handlers.ImportHandler
importRepository *repositories.Import_Repository
valueRepository *repositories.Value_Repository
propertyRepository *repositories.Property_Repository
propertyTypeRepository *repositories.Property_Type_Repository
propertyTypeGroupRepository *repositories.Property_Types_Group_Repository
} }
func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer { func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
// db initialization can be done here if needed
// repository initialisation: // repository initialisation:
valueRepository := repositories.NewValueRepository(dbHandler)
propertyRepository := repositories.NewPropertyRepository(dbHandler, valueRepository)
propertyTypeRepository := repositories.NewPropertyTypeRepository(dbHandler, propertyRepository)
propertyTypeGroupRepository := repositories.NewPropertyTypesGroupRepository(dbHandler, propertyTypeRepository)
importRepository := repositories.NewImportRepository(dbHandler, valueRepository, propertyTypeRepository, propertyTypeGroupRepository, propertyRepository)
// service initialisation: // service initialisation:
importService := services.NewImportService(importRepository)
// controller initialisation: // handler initialisation:
importHandler := handlers.NewImportHandler(importService)
// Service API // Service API
router := gin.Default() router := gin.Default()
@@ -40,16 +57,22 @@ func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
*/ */
// import // import
router.POST("/import", handlers.ImportHandler_PropertyTypesGroup) router.POST("/importPropertyTypes", importHandler.ImportPropertyTypeGroups)
// test endpoint // test endpoint
router.GET("/test", Test) router.GET("/test", Test)
// server // server
return HttpServer{ return HttpServer{
config: config, config: config,
router: router, router: router,
dbHandler: dbHandler, dbHandler: dbHandler,
importHandler: importHandler,
importRepository: importRepository,
valueRepository: valueRepository,
propertyRepository: propertyRepository,
propertyTypeRepository: propertyTypeRepository,
propertyTypeGroupRepository: propertyTypeGroupRepository,
} }
} }
@@ -1,97 +1,286 @@
[{ [
"name": "Simply CPQ", {
"description": "Property Type Group for Simply CPQ", "name": "X-CPQ",
"property_types_groups": [ "description": "Property Type Group for X-CPQ",
{ "property_types_Groups": [
"name": "electrical", {
"description": "All electrical property types", "name": "electrical",
"property_types": [ "description": "All electrical property types",
{ "property_types": [
"name": "Spannungsversorgung (V)", {
"description": "Spannungsversorgung (V)" "name": "Spannungsversorgung (V)",
}, "description": "Spannungsversorgung (V)",
{ "property": {
"name": "Leistung (W)", "name": "Spannungsversorgung (V)",
"description": "Leistung" "description": "Spannungsversorgung (V)",
}, "values": [
{ { "value": "220" },
"name": "Eingangsimpedanz (Ω)", { "value": "230" }
"description": "Wiederstand der Eingangsimpedanz" ]
}, }
{ },
"name": "Frequenzbereich (Hz‑kHz)", {
"description": "Frequenzbereich (Hz‑kHz)" "name": "Leistung (W)",
}, "description": "Leistung",
{ "property": {
"name": "Signal‑Rausch‑Verhältnis (dB)", "name": "Leistung (W)",
"description": "Signal‑Rausch‑Verhältnis (dB)" "description": "Leistung",
}, "values": [
{ { "value": "0" },
"name": "Anschlüsse", { "value": "140" },
"description": "Anschlüsse" { "value": "130" },
}, { "value": "120" },
{ { "value": "110" },
"name": "Ausgangsimpedanz (Ω)", { "value": "100" },
"description": "Ausgangsimpedanz (Ω)" { "value": "90" },
} { "value": "80" },
] { "value": "70" },
}, { "value": "60" },
{ { "value": "50" },
"name": "mechanical", { "value": "28" },
"description": "All mechanical properties", { "value": "26" },
"property_types":[ { "value": "24" },
{ { "value": "22" },
"name": "Abmessungen (mm)", { "value": "20" }
"description": "All mechanical properties" ]
}, }
{ },
"name": "Gewicht (kg)", {
"description": "All mechanical properties" "name": "Eingangsimpedanz (Ω)",
}, "description": "Wiederstand der Eingangsimpedanz",
{ "property": {
"name": "Kapazität (kg)", "name": "Eingangsimpedanz (Ω)",
"description": "All mechanical properties" "description": "Wiederstand der Eingangsimpedanz",
}, "values": [
{ { "value": "10" }
"name": "Programms/Features", ]
"description": "All mechanical properties" }
}, },
{ {
"name": "Wasserverbrauch pro Zyklus (L)", "name": "Frequenzbereich (Hz‑kHz)",
"description": "All mechanical properties" "description": "Frequenzbereich (Hz‑kHz)",
}, "property": {
{ "name": "Frequenzbereich (Hz‑kHz)",
"name": "Material Innenraum", "description": "Frequenzbereich (Hz‑kHz)",
"description": "All mechanical properties" "values": [
} { { "value": "87‑108" }
"name": "Kapazität/Volumen (L)", ]
"description": "All mechanical properties" }
}, },
{ {
"name": "Schleuderdrehzahl (U/min)", "name": "Signal‑Rausch‑Verhältnis (dB)",
"description": "All mechanical properties" "description": "Signal‑Rausch‑Verhältnis (dB)",
} "property": {
] "name": "Signal‑Rausch‑Verhältnis (dB)",
}, "description": "Signal‑Rausch‑Verhältnis (dB)",
{ "values": [
"name": "other", { "value": "48" },
"description": "All other properties", { "value": "46" },
"property_types":[ { "value": "47" },
{ { "value": "45" },
"name": "Preis (USD)", { "value": "49" },
"description": "All other properties" { "value": "44" }
}, ]
{ }
"name": "Zusatzfunktionen", },
"description": "All other properties" {
}, { "name": "Anschlüsse",
"name": "Bedienungsart", "description": "Anschlüsse",
"description": "All other properties" "property": {
}, { "name": "Anschlüsse",
"name": "Energieeffizienzklasse", "description": "Anschlüsse",
"description": "All other properties" "values": [
} { "value": "UKW+Bluetooth+DL" },
] { "value": "UKW+Wi‑Fi+DL" },
} { "value": "UKW+DL+Bluetooth" },
] { "value": "UKW+Bluetooth+Wi‑Fi" },
}] { "value": "UKW+Wi‑Fi+DL" },
{ "value": "UKW+Wi‑Fi" },
{ "value": "UKW+Bluetooth" },
{ "value": "UKW+DL" },
{ "value": "UKW" }
]
}
},
{
"name": "Ausgangsimpedanz (Ω)",
"description": "Ausgangsimpedanz (Ω)",
"property": {
"name": "Ausgangsimpedanz (Ω)",
"description": "Ausgangsimpedanz (Ω)",
"values": [
{ "value": "75" }
]
}
}
]
},
{
"name": "mechanical",
"description": "All mechanical properties",
"property_types": [
{
"name": "Abmessungen (mm)",
"description": "All mechanical properties",
"property": {
"name": "Abmessungen (mm)",
"description": "All mechanical properties",
"values": [
{ "value": "158x88x33" },
{ "value": "310x210x110" },
{ "value": "160x90x35" },
{ "value": "170x100x42" },
{ "value": "150x80x30" },
{ "value": "155x85x32" },
{ "value": "165x95x38" },
{ "value": "305x205x105" },
{ "value": "172x102x44" },
{ "value": "340x240x140" },
{ "value": "420x320x140" },
{ "value": "162x92x36" },
{ "value": "300x200x100" },
{ "value": "168x98x40" },
{ "value": "315x215x115" },
{ "value": "325x225x125" },
{ "value": "415x315x135" },
{ "value": "320x220x120" },
{ "value": "335x235x135" },
{ "value": "330x230x130" },
{ "value": "400x300x120" },
{ "value": "405x305x125" },
{ "value": "345x245x145" },
{ "value": "295x245x135" },
{ "value": "410x310x130" },
{ "value": "290x240x130" },
{ "value": "285x235x125" },
{ "value": "280x230x120" },
{ "value": "275x225x115" },
{ "value": "270x220x110" },
{ "value": "265x215x105" },
{ "value": "255x205x95" },
{ "value": "260x210x100" },
{ "value": "250x200x90" },
{ "value": "445x345x165" },
{ "value": "440x340x160" },
{ "value": "435x335x155" },
{ "value": "430x330x150" },
{ "value": "425x325x145" }
]
},
{
"name": "Gewicht (kg)",
"description": "All mechanical properties",
"property": {
"name": "Gewicht (kg)",
"description": "All mechanical properties",
"values": [
{ "value": "3" },
{ "value": "6" },
{ "value": "4" },
{ "value": "2" }
]
}
},
{
"name": "Kapazität (kg)",
"description": "All mechanical properties",
"property": {
"name": "Kapazität (kg)",
"description": "All mechanical properties",
"values": [
{ "value": "0" }
]
}
},
{
"name": "Programms/Features",
"description": "All mechanical properties",
"property": {
"name": "Programms/Features",
"description": "All mechanical properties",
"values": []
}
},
{
"name": "Wasserverbrauch pro Zyklus (L)",
"description": "All mechanical properties",
"property": {
"name": "Wasserverbrauch pro Zyklus (L)",
"description": "All mechanical properties",
"values": []
}
},
{
"name": "Material Innenraum",
"description": "All mechanical properties",
"property": {
"name": "Material Innenraum",
"description": "All mechanical properties",
"values": []
}
},
{
"name": "Kapazität/Volumen (L)",
"description": "All mechanical properties",
"property": {
"name": "Kapazität/Volumen (L)",
"description": "All mechanical properties",
"values": []
}
},
{
"name": "Schleuderdrehzahl (U/min)",
"description": "All mechanical properties",
"property": {
"name": "Schleuderdrehzahl (U/min)",
"description": "All mechanical properties",
"values": []
}
}
]
},
{
"name": "other",
"description": "All other properties",
"property_types": [
{
"name": "Preis (USD)",
"description": "All other properties",
"property": {
"name": "Preis (USD)",
"description": "All other properties",
"values": []
}
},
{
"name": "Zusatzfunktionen",
"description": "All other properties",
"property": {
"name": "Zusatzfunktionen",
"description": "All other properties",
"values": []
}
},
{
"name": "Bedienungsart",
"description": "All other properties",
"property": {
"name": "Bedienungsart",
"description": "All other properties",
"values": []
}
},
{
"name": "Energieeffizienzklasse",
"description": "All other properties",
"property": {
"name": "Energieeffizienzklasse",
"description": "All other properties",
"values": []
}
}
]
}
]
}
]
@@ -1,13 +1,25 @@
package handlers package handlers
import ( import (
"log"
"net/http" "net/http"
"xcpq_editor/internal/models" "xcpq_editor/internal/models"
"xcpq_editor/internal/services"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
func ImportHandler_PropertyTypesGroup(ctx *gin.Context) { type ImportHandler struct {
importService *services.Import_Service
}
func NewImportHandler(i *services.Import_Service) *ImportHandler {
return &ImportHandler{
importService: i,
}
}
func (h *ImportHandler) ImportPropertyTypeGroups(ctx *gin.Context) {
// Handle the import request here // Handle the import request here
var importData []models.Property_Types_Group var importData []models.Property_Types_Group
@@ -16,6 +28,16 @@ func ImportHandler_PropertyTypesGroup(ctx *gin.Context) {
return return
} }
for _, item := range importData {
log.Println("Importing property types group with ID:", item.Id)
log.Println("Anzahl Sub-Groups:", len(item.Property_Types_Groups))
err := h.importService.ImportPropertyTypesData(&item, nil)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
}
ctx.JSON(http.StatusOK, gin.H{ ctx.JSON(http.StatusOK, gin.H{
"message": "Import successful", "message": "Import successful",
}) })
@@ -1,7 +1,7 @@
package models package models
type Property struct { type Property struct {
Id int `json:"id"` Id int `json:"id,omitempty"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"` Image_Url string `json:"image_url,omitempty"`
@@ -1,7 +1,7 @@
package models package models
type Property_Type struct { type Property_Type struct {
Id int `json:"id"` Id int `json:"id,omitempty"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"` Image_Url string `json:"image_url,omitempty"`
@@ -1,7 +1,7 @@
package models package models
type Property_Types_Group struct { type Property_Types_Group struct {
Id int `json:"id"` Id int `json:"id,omitempty"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"` Image_Url string `json:"image_url,omitempty"`
@@ -1,7 +1,7 @@
package models package models
type Value struct { type Value struct {
Id int `json:"id"` Id int `json:"id,omitempty"`
Value string `json:"value"` Value string `json:"value"`
Image_Url string `json:"image_url,omitempty"` Image_Url string `json:"image_url,omitempty"`
} }
@@ -2,6 +2,7 @@ package repositories
import ( import (
"database/sql" "database/sql"
"log"
"xcpq_editor/internal/models" "xcpq_editor/internal/models"
) )
@@ -13,7 +14,7 @@ type Import_Repository struct {
pr *Property_Repository pr *Property_Repository
} }
func NewImport_Repository(db *sql.DB, vr *Value_Repository, pt *Property_Type_Repository, ptg *Property_Types_Group_Repository, pr *Property_Repository) *Import_Repository { func NewImportRepository(db *sql.DB, vr *Value_Repository, pt *Property_Type_Repository, ptg *Property_Types_Group_Repository, pr *Property_Repository) *Import_Repository {
return &Import_Repository{ return &Import_Repository{
db: db, db: db,
vr: vr, vr: vr,
@@ -34,14 +35,17 @@ func (r *Import_Repository) ImportPropertyTypesData(newGroup *models.Property_Ty
if err != nil { if err != nil {
return err return err
} }
log.Println("Created new property types group with ID:", group.Id)
newGroup.Id = group.Id newGroup.Id = group.Id
for _, childPropertyType := range newGroup.Property_Types { for _, childPropertyType := range newGroup.Property_Types {
log.Println("Creating new property type with ID:", childPropertyType.Id)
_, err := r.pt.CreatePropertyType(&childPropertyType, newGroup, &childPropertyType.Property) _, err := r.pt.CreatePropertyType(&childPropertyType, newGroup, &childPropertyType.Property)
if err != nil { if err != nil {
return err return err
} }
} }
for _, childGroup := range newGroup.Property_Types_Groups { for _, childGroup := range newGroup.Property_Types_Groups {
log.Println("Importing child property types group with ID:", childGroup.Id)
err := r.ImportPropertyTypesData(&childGroup, newGroup) err := r.ImportPropertyTypesData(&childGroup, newGroup)
if err != nil { if err != nil {
return err return err
@@ -45,8 +45,8 @@ func (pr *Property_Repository) CreateProperty(
parent_property_id = 0 parent_property_id = 0
} }
query := `INSERT INTO properties (name, description, parent_property_id, property_type_id, product_id, image_url) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id` query := `INSERT INTO properties.properties (name, description, parent_property_id, property_type_id, products_id, image_url) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id`
err := pr.db.QueryRow(query, property.Name, property.Description, parent_property_id, property_type_id, product_id, property.image_url).Scan(&property.Id) err := pr.db.QueryRow(query, property.Name, property.Description, parent_property_id, property_type_id, product_id, property.Image_Url).Scan(&property.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -70,10 +70,10 @@ func (pr *Property_Repository) CreateProperty(
func (pr *Property_Repository) GetPropertyById(id int) (*models.Property, error) { func (pr *Property_Repository) GetPropertyById(id int) (*models.Property, error) {
// Implement the logic to retrieve a property by its ID from the database // Implement the logic to retrieve a property by its ID from the database
query := `SELECT id, name, description, parent_property_id, image_url FROM properties WHERE id = $1` query := `SELECT id, name, description, parent_property_id, image_url FROM properties.properties WHERE id = $1`
property := &models.Property{} property := &models.Property{}
var parent_property_id int var parent_property_id int
err := pr.db.QueryRow(query, id).Scan(&property.Id, &property.Name, &property.Description, &parent_property_id, &property.image_url) err := pr.db.QueryRow(query, id).Scan(&property.Id, &property.Name, &property.Description, &parent_property_id, &property.Image_Url)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -103,8 +103,8 @@ func (pr *Property_Repository) GetPropertyById(id int) (*models.Property, error)
func (pr *Property_Repository) UpdateProperty(property *models.Property) error { func (pr *Property_Repository) UpdateProperty(property *models.Property) error {
// Implement the logic to update an existing property in the database // Implement the logic to update an existing property in the database
query := `UPDATE properties SET name=$1, description=$2, image_url=$3 WHERE id=$4` query := `UPDATE properties.properties SET name=$1, description=$2, image_url=$3 WHERE id=$4`
_, err := pr.db.Exec(query, property.Name, property.Description, property.image_url, property.Id) _, err := pr.db.Exec(query, property.Name, property.Description, property.Image_Url, property.Id)
return err return err
} }
@@ -116,7 +116,7 @@ func (pr *Property_Repository) DeleteProperty(id int) error {
return err return err
} }
query := `DELETE FROM properties WHERE id=$1` query := `DELETE FROM properties.properties WHERE id=$1`
_, err = pr.db.Exec(query, id) _, err = pr.db.Exec(query, id)
return err return err
} }
@@ -29,8 +29,8 @@ func (ptr *Property_Type_Repository) CreatePropertyType(
} else { } else {
property_type_group_id = 0 property_type_group_id = 0
} }
query := `INSERT INTO property_types (name, description, property_type_group_id, image_url) VALUES ($1, $2, $3, $4) RETURNING id` query := `INSERT INTO properties.property_types (name, description, property_types_groups_id, image_url) VALUES ($1, $2, $3, $4) RETURNING id`
err := ptr.db.QueryRow(query, property_type.Name, property_type.Description, property_type_group_id, property_type.image_url).Scan(&property_type.Id) err := ptr.db.QueryRow(query, property_type.Name, property_type.Description, property_type_group_id, property_type.Image_Url).Scan(&property_type.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -50,9 +50,9 @@ func (ptr *Property_Type_Repository) CreatePropertyType(
func (ptr *Property_Type_Repository) GetPropertyTypeById(id int) (*models.Property_Type, error) { func (ptr *Property_Type_Repository) GetPropertyTypeById(id int) (*models.Property_Type, error) {
// Implement the logic to retrieve a property type by its ID from the database // Implement the logic to retrieve a property type by its ID from the database
query := "SELECT id, name, description, image_url FROM property_types WHERE id = $1" query := "SELECT id, name, description, image_url FROM properties.property_types WHERE id = $1"
property_type := &models.Property_Type{} property_type := &models.Property_Type{}
err := ptr.db.QueryRow(query, id).Scan(&property_type.Id, &property_type.Name, &property_type.Description, &property_type.image_url) err := ptr.db.QueryRow(query, id).Scan(&property_type.Id, &property_type.Name, &property_type.Description, &property_type.Image_Url)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -63,14 +63,14 @@ func (ptr *Property_Type_Repository) GetPropertyTypeById(id int) (*models.Proper
func (ptr *Property_Type_Repository) UpdatePropertyType(property_type *models.Property_Type) error { func (ptr *Property_Type_Repository) UpdatePropertyType(property_type *models.Property_Type) error {
// Implement the logic to update the label/description of an existing property type // Implement the logic to update the label/description of an existing property type
query := `UPDATE property_types SET name=$1, description=$2, image_url=$3 WHERE id=$4` query := `UPDATE properties.property_types SET name=$1, description=$2, image_url=$3 WHERE id=$4`
_, err := ptr.db.Exec(query, property_type.Name, property_type.Description, property_type.image_url, property_type.Id) _, err := ptr.db.Exec(query, property_type.Name, property_type.Description, property_type.Image_Url, property_type.Id)
return err return err
} }
func (ptr *Property_Type_Repository) DeletePropertyTypeById(id int) error { func (ptr *Property_Type_Repository) DeletePropertyTypeById(id int) error {
// Implement the logic to delete a property type from the database // Implement the logic to delete a property type from the database
query := `DELETE FROM property_types WHERE id=$1` query := `DELETE FROM properties.property_types WHERE id=$1`
_, err := ptr.db.Exec(query, id) _, err := ptr.db.Exec(query, id)
return err return err
} }
@@ -25,10 +25,10 @@ func (ptrg *Property_Types_Group_Repository) CreatePropertyTypesGroup(property_t
parentPropertyTypeGroup.Property_Types_Groups = append(parentPropertyTypeGroup.Property_Types_Groups, *property_types_group) parentPropertyTypeGroup.Property_Types_Groups = append(parentPropertyTypeGroup.Property_Types_Groups, *property_types_group)
} else { } else {
parentId = 0 // or any other value that indicates no parent parentId = 0 // or any other value that indicates no parent
property_types_group.Property_Types_Groups = []models.Property_Types_Group{} //property_types_group.Property_Types_Groups = []models.Property_Types_Group{}
property_types_group.Property_Types = []models.Property_Type{} //property_types_group.Property_Types = []models.Property_Type{}
} }
query := `INSERT INTO property_types_groups (name, description, image_url, parent_property_type_group) VALUES ($1, $2, $3, $4) RETURNING id` query := `INSERT INTO properties.property_types_groups (name, description, image_url, parent_property_type_group_id) VALUES ($1, $2, $3, $4) RETURNING id`
err := ptrg.db.QueryRow(query, property_types_group.Name, property_types_group.Description, property_types_group.Image_Url, parentId).Scan(&property_types_group.Id) err := ptrg.db.QueryRow(query, property_types_group.Name, property_types_group.Description, property_types_group.Image_Url, parentId).Scan(&property_types_group.Id)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -38,7 +38,7 @@ func (ptrg *Property_Types_Group_Repository) CreatePropertyTypesGroup(property_t
func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupById(id int) (*models.Property_Types_Group, error) { func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupById(id int) (*models.Property_Types_Group, error) {
// Implement the logic to retrieve a property types group by its ID from the database // Implement the logic to retrieve a property types group by its ID from the database
query := "SELECT id, name, description, image_url FROM property_types_groups WHERE id = $1" query := "SELECT id, name, description, image_url FROM properties.property_types_groups WHERE id = $1"
property_types_group := &models.Property_Types_Group{} property_types_group := &models.Property_Types_Group{}
err := ptrg.db.QueryRow(query, id).Scan(&property_types_group.Id, &property_types_group.Name, &property_types_group.Description, &property_types_group.Image_Url) err := ptrg.db.QueryRow(query, id).Scan(&property_types_group.Id, &property_types_group.Name, &property_types_group.Description, &property_types_group.Image_Url)
if err != nil { if err != nil {
@@ -46,7 +46,7 @@ func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupById(id int) (
} }
// get all childs // get all childs
queryChilds := "SELECT id FROM property_types_groups WHERE parent_property_type_group = $1" queryChilds := "SELECT id FROM properties.property_types_groups WHERE parent_property_types_groups_id = $1"
rows, err := ptrg.db.Query(queryChilds, id) rows, err := ptrg.db.Query(queryChilds, id)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -92,18 +92,18 @@ func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupById(id int) (
func (ptrg *Property_Types_Group_Repository) UpdatePropertyTypesGroup(property_types_group *models.Property_Types_Group) error { func (ptrg *Property_Types_Group_Repository) UpdatePropertyTypesGroup(property_types_group *models.Property_Types_Group) error {
// Implement the logic to update the label/description of an existing property types group // Implement the logic to update the label/description of an existing property types group
query := `UPDATE property_types_groups SET name=$1, description=$2, image_url=$3 WHERE id=$4` query := `UPDATE properties.property_types_groups SET name=$1, description=$2, image_url=$3 WHERE id=$4`
_, err := ptrg.db.Exec(query, property_types_group.Name, property_types_group.Description, property_types_group.Image_Url, property_types_group.Id) _, err := ptrg.db.Exec(query, property_types_group.Name, property_types_group.Description, property_types_group.Image_Url, property_types_group.Id)
return err return err
} }
func (ptrg *Property_Types_Group_Repository) DeletePropertyTypesGroup(id int) error { func (ptrg *Property_Types_Group_Repository) DeletePropertyTypesGroup(id int) error {
// Implement the logic to delete a property types group from the database // Implement the logic to delete a property types group from the database
query := `DELETE FROM property_types_groups WHERE id=$1` query := `DELETE FROM properties.property_types_groups WHERE id=$1`
_, err := ptrg.db.Exec(query, id) _, err := ptrg.db.Exec(query, id)
// delete all child property types groups // delete all child property types groups
queryChilds := "SELECT id FROM property_types_groups WHERE parent_property_type_group = $1" queryChilds := "SELECT id FROM properties.property_types_groups WHERE parent_property_types_groups_id = $1"
rows, err := ptrg.db.Query(queryChilds, id) rows, err := ptrg.db.Query(queryChilds, id)
if err != nil { if err != nil {
return err return err
@@ -123,7 +123,7 @@ func (ptrg *Property_Types_Group_Repository) DeletePropertyTypesGroup(id int) er
} }
// delete all property types in this group // delete all property types in this group
queryProperties := "SELECT id FROM property_types WHERE property_types_group = $1" queryProperties := "SELECT id FROM properties.property_types WHERE property_types_group = $1"
rowsProperties, err := ptrg.db.Query(queryProperties, id) rowsProperties, err := ptrg.db.Query(queryProperties, id)
if err != nil { if err != nil {
return err return err
@@ -17,7 +17,7 @@ func NewValueRepository(db *sql.DB) *Value_Repository {
func (vr *Value_Repository) CreateValueForPropertyId(propertyId int, value *models.Value) (*models.Value, error) { func (vr *Value_Repository) CreateValueForPropertyId(propertyId int, value *models.Value) (*models.Value, error) {
// Implement the logic to create a new value for the given propertyId in the database // Implement the logic to create a new value for the given propertyId in the database
query := `INSERT INTO values (propertyid, value, image_url) VALUES ($1, $2, $3) RETURNING id` query := `INSERT INTO properties.values (propertyid, value, image_url) VALUES ($1, $2, $3) RETURNING id`
err := vr.db.QueryRow(query, propertyId, value.Value, value.Image_Url).Scan(&value.Id) err := vr.db.QueryRow(query, propertyId, value.Value, value.Image_Url).Scan(&value.Id)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -27,21 +27,21 @@ func (vr *Value_Repository) CreateValueForPropertyId(propertyId int, value *mode
func (vr *Value_Repository) DeleteValueFromPropertyId(valueId int, propertyId int) error { func (vr *Value_Repository) DeleteValueFromPropertyId(valueId int, propertyId int) error {
// Implement the logic to delete the value from the database for the given valueId and propertyId // Implement the logic to delete the value from the database for the given valueId and propertyId
query := `DELETE FROM values WHERE id=$1 AND propertyid=$2` query := `DELETE FROM properties.values WHERE id=$1 AND propertyid=$2`
_, err := vr.db.Exec(query, valueId, propertyId) _, err := vr.db.Exec(query, valueId, propertyId)
return err return err
} }
func (vr *Value_Repository) UpdateValue(value *models.Value) error { func (vr *Value_Repository) UpdateValue(value *models.Value) error {
// Implement the logic to update the value in the database for the given valueId // Implement the logic to update the value in the database for the given valueId
query := `UPDATE values SET value=$1, image_url=$2 WHERE id=$3` query := `UPDATE properties.values SET value=$1, image_url=$2 WHERE id=$3`
_, err := vr.db.Exec(query, value.Value, value.Image_Url, value.Id) _, err := vr.db.Exec(query, value.Value, value.Image_Url, value.Id)
return err return err
} }
func (vr *Value_Repository) GetValue(id int) (*models.Value, error) { func (vr *Value_Repository) GetValue(id int) (*models.Value, error) {
// Implement the logic to retrieve a value by its ID from the database // Implement the logic to retrieve a value by its ID from the database
query := "SELECT id, value, image_url FROM values WHERE id = $1" query := "SELECT id, value, image_url FROM properties.values WHERE id = $1"
row := vr.db.QueryRow(query, id) row := vr.db.QueryRow(query, id)
value := &models.Value{} value := &models.Value{}
err := row.Scan(&value.Id, &value.Value, &value.Image_Url) err := row.Scan(&value.Id, &value.Value, &value.Image_Url)
@@ -53,14 +53,14 @@ func (vr *Value_Repository) GetValue(id int) (*models.Value, error) {
func (vr *Value_Repository) DeleteValuesFromPropertyId(propertyId int) error { func (vr *Value_Repository) DeleteValuesFromPropertyId(propertyId int) error {
// Implement the logic to delete all values from the database for the given propertyId // Implement the logic to delete all values from the database for the given propertyId
query := `DELETE FROM values WHERE propertyid=$1` query := `DELETE FROM properties.values WHERE propertyid=$1`
_, err := vr.db.Exec(query, propertyId) _, err := vr.db.Exec(query, propertyId)
return err return err
} }
func (vr *Value_Repository) GetValuesFromPropertyId(propertyId int) ([]*models.Value, error) { func (vr *Value_Repository) GetValuesFromPropertyId(propertyId int) ([]*models.Value, error) {
// Implement the logic to retrieve all values from the database for the given propertyId // Implement the logic to retrieve all values from the database for the given propertyId
query := `SELECT id, value, image_url FROM values WHERE propertyid=$1` query := `SELECT id, value, image_url FROM properties.values WHERE propertyid=$1`
rows, err := vr.db.Query(query, propertyId) rows, err := vr.db.Query(query, propertyId)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -9,7 +9,7 @@ type Import_Service struct {
importRepository *repositories.Import_Repository importRepository *repositories.Import_Repository
} }
func NewImport_Service(importRepository *repositories.Import_Repository) *Import_Service { func NewImportService(importRepository *repositories.Import_Repository) *Import_Service {
return &Import_Service{ return &Import_Service{
importRepository: importRepository, importRepository: importRepository,
} }
+329
View File
@@ -0,0 +1,329 @@
--
-- PostgreSQL database dump
--
\restrict QLwsCbodiNlV3JQJRfmAVxaxLqILLV0Fv9uJeVlzDiu4p6FKUIYquZWE1PbaK7o
-- Dumped from database version 18.4 (Debian 18.4-1.pgdg13+1)
-- Dumped by pg_dump version 18.4
-- Started on 2026-09-14 14:31:10
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 6 (class 2615 OID 20689)
-- Name: properties; Type: SCHEMA; Schema: -; Owner: tsindt
--
CREATE SCHEMA properties;
ALTER SCHEMA properties OWNER TO tsindt;
--
-- TOC entry 3481 (class 0 OID 0)
-- Dependencies: 6
-- Name: SCHEMA properties; Type: COMMENT; Schema: -; Owner: tsindt
--
COMMENT ON SCHEMA properties IS 'Alle Tabellen, die mit Properties und Values zu tun haben.';
--
-- TOC entry 220 (class 1259 OID 20691)
-- Name: properties_id_seq; Type: SEQUENCE; Schema: properties; Owner: tsindt
--
CREATE SEQUENCE properties.properties_id_seq
START WITH 1000000
INCREMENT BY 1
MINVALUE 1000000
MAXVALUE 4999999
CACHE 1;
ALTER SEQUENCE properties.properties_id_seq OWNER TO tsindt;
--
-- TOC entry 3482 (class 0 OID 0)
-- Dependencies: 220
-- Name: SEQUENCE properties_id_seq; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON SEQUENCE properties.properties_id_seq IS 'Zähler für property und value IDs ';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 223 (class 1259 OID 20722)
-- Name: properties; Type: TABLE; Schema: properties; Owner: tsindt
--
CREATE TABLE properties.properties (
id bigint DEFAULT nextval('properties.properties_id_seq'::regclass) NOT NULL,
name text,
description text,
parent_property_id bigint DEFAULT 0 NOT NULL,
property_type_id bigint NOT NULL,
products_groups_id bigint DEFAULT 0 NOT NULL,
products_id bigint DEFAULT 0 NOT NULL,
image_url text DEFAULT 'https://www.thomas-sindt.de/img/properties_group.svg'::text
);
ALTER TABLE properties.properties OWNER TO tsindt;
--
-- TOC entry 3483 (class 0 OID 0)
-- Dependencies: 223
-- Name: TABLE properties; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON TABLE properties.properties IS 'Eigenschaften, die Listen von Werten enthalten und eine Information, von welchem property sich dieses Property ableitet. Ist parent_property_id = 0, dann ist dieses ein Root-Property zu dem referenzierten PropertyType.';
--
-- TOC entry 3484 (class 0 OID 0)
-- Dependencies: 223
-- Name: COLUMN properties.name; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON COLUMN properties.properties.name IS 'Der Name sollte derselbe sein, wie der referenzierte Property Type.';
--
-- TOC entry 3485 (class 0 OID 0)
-- Dependencies: 223
-- Name: COLUMN properties.products_groups_id; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON COLUMN properties.properties.products_groups_id IS 'Referenziert auf dieProduktgruppe, zu dem dieses Property gehört. Wenn es zu keiner Produktgruppe gehört ist diese referenz = 0';
--
-- TOC entry 3486 (class 0 OID 0)
-- Dependencies: 223
-- Name: COLUMN properties.products_id; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON COLUMN properties.properties.products_id IS 'Referenziert auf das Produkt, zu dem dieses Property gehört. Wenn es zu keinem Produkt gehört ist diese referenz = 0';
--
-- TOC entry 222 (class 1259 OID 20707)
-- Name: property_types; Type: TABLE; Schema: properties; Owner: tsindt
--
CREATE TABLE properties.property_types (
id bigint DEFAULT nextval('properties.properties_id_seq'::regclass) NOT NULL,
name text,
description text,
property_types_groups_id bigint NOT NULL,
image_url text DEFAULT 'https://www.thomas-sindt.de/img/category.svg'::text
);
ALTER TABLE properties.property_types OWNER TO tsindt;
--
-- TOC entry 3487 (class 0 OID 0)
-- Dependencies: 222
-- Name: TABLE property_types; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON TABLE properties.property_types IS 'Definition von properties';
--
-- TOC entry 221 (class 1259 OID 20698)
-- Name: property_types_groups; Type: TABLE; Schema: properties; Owner: tsindt
--
CREATE TABLE properties.property_types_groups (
id bigint DEFAULT nextval('properties.properties_id_seq'::regclass) CONSTRAINT property_types_group_id_not_null NOT NULL,
name text,
description text,
parent_property_type_group_id bigint,
image_url text DEFAULT 'https://thomas-sindt/img/category.svg'::text
);
ALTER TABLE properties.property_types_groups OWNER TO tsindt;
--
-- TOC entry 3488 (class 0 OID 0)
-- Dependencies: 221
-- Name: TABLE property_types_groups; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON TABLE properties.property_types_groups IS 'Baumstruktur zur Organisation von Property types
Wenn parent_property_types_group = 0, dann ist diese Gruppe eine Rootgruppe.';
--
-- TOC entry 224 (class 1259 OID 20743)
-- Name: values; Type: TABLE; Schema: properties; Owner: tsindt
--
CREATE TABLE properties."values" (
id bigint DEFAULT nextval('properties.properties_id_seq'::regclass) NOT NULL,
value text,
properties_id bigint NOT NULL,
image_url text DEFAULT 'https://www.thomas-sindt.de/img/property.svg'::text
);
ALTER TABLE properties."values" OWNER TO tsindt;
--
-- TOC entry 3474 (class 0 OID 20722)
-- Dependencies: 223
-- Data for Name: properties; Type: TABLE DATA; Schema: properties; Owner: tsindt
--
COPY properties.properties (id, name, description, parent_property_id, property_type_id, products_groups_id, products_id, image_url) FROM stdin;
\.
--
-- TOC entry 3473 (class 0 OID 20707)
-- Dependencies: 222
-- Data for Name: property_types; Type: TABLE DATA; Schema: properties; Owner: tsindt
--
COPY properties.property_types (id, name, description, property_types_groups_id, image_url) FROM stdin;
\.
--
-- TOC entry 3472 (class 0 OID 20698)
-- Dependencies: 221
-- Data for Name: property_types_groups; Type: TABLE DATA; Schema: properties; Owner: tsindt
--
COPY properties.property_types_groups (id, name, description, parent_property_type_group_id, image_url) FROM stdin;
\.
--
-- TOC entry 3475 (class 0 OID 20743)
-- Dependencies: 224
-- Data for Name: values; Type: TABLE DATA; Schema: properties; Owner: tsindt
--
COPY properties."values" (id, value, properties_id, image_url) FROM stdin;
\.
--
-- TOC entry 3489 (class 0 OID 0)
-- Dependencies: 220
-- Name: properties_id_seq; Type: SEQUENCE SET; Schema: properties; Owner: tsindt
--
SELECT pg_catalog.setval('properties.properties_id_seq', 1000000, false);
--
-- TOC entry 3318 (class 2606 OID 20733)
-- Name: properties properties_pkey; Type: CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties.properties
ADD CONSTRAINT properties_pkey PRIMARY KEY (id);
--
-- TOC entry 3314 (class 2606 OID 20706)
-- Name: property_types_groups property_types_group_pkey; Type: CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties.property_types_groups
ADD CONSTRAINT property_types_group_pkey PRIMARY KEY (id);
--
-- TOC entry 3316 (class 2606 OID 20716)
-- Name: property_types property_types_pkey; Type: CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties.property_types
ADD CONSTRAINT property_types_pkey PRIMARY KEY (id);
--
-- TOC entry 3320 (class 2606 OID 20752)
-- Name: values values_pkey; Type: CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties."values"
ADD CONSTRAINT values_pkey PRIMARY KEY (id);
--
-- TOC entry 3322 (class 2606 OID 20734)
-- Name: properties parent_property_type_id_fk; Type: FK CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties.properties
ADD CONSTRAINT parent_property_type_id_fk FOREIGN KEY (property_type_id) REFERENCES properties.property_types(id);
--
-- TOC entry 3490 (class 0 OID 0)
-- Dependencies: 3322
-- Name: CONSTRAINT parent_property_type_id_fk ON properties; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON CONSTRAINT parent_property_type_id_fk ON properties.properties IS 'Verweißt auf den Property Type dieses Properties';
--
-- TOC entry 3323 (class 2606 OID 20753)
-- Name: values properties_id_fk; Type: FK CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties."values"
ADD CONSTRAINT properties_id_fk FOREIGN KEY (properties_id) REFERENCES properties.properties(id);
--
-- TOC entry 3321 (class 2606 OID 20717)
-- Name: property_types property_types_groups_id_fk; Type: FK CONSTRAINT; Schema: properties; Owner: tsindt
--
ALTER TABLE ONLY properties.property_types
ADD CONSTRAINT property_types_groups_id_fk FOREIGN KEY (property_types_groups_id) REFERENCES properties.property_types_groups(id);
--
-- TOC entry 3491 (class 0 OID 0)
-- Dependencies: 3321
-- Name: CONSTRAINT property_types_groups_id_fk ON property_types; Type: COMMENT; Schema: properties; Owner: tsindt
--
COMMENT ON CONSTRAINT property_types_groups_id_fk ON properties.property_types IS 'Referenz auf die Property Type Gruppe, zu der dieser Property Type gehört.';
-- Completed on 2026-09-14 14:31:11
--
-- PostgreSQL database dump complete
--
\unrestrict QLwsCbodiNlV3JQJRfmAVxaxLqILLV0Fv9uJeVlzDiu4p6FKUIYquZWE1PbaK7o