Compare commits

...
26 Commits
Author SHA1 Message Date
tsindt 62af3f17f2 Tree steht 2026-09-16 16:32:31 +02:00
tsindt c755a80b47 test 2026-09-15 23:03:10 +02:00
tsindt dcb6295091 Propertytypegroups-Tree 2026-09-15 19:27:04 +02:00
tsindt 33acfb0bfc Datebimport 2026-09-15 13:22:53 +02:00
tsindt 6feaaa56eb Bugfixing import properties 2026-09-14 23:11:02 +02:00
tsindt 25b3923427 Property Import 2026-09-14 21:15:09 +02:00
tsindt a7ef4e52ca Merge branch 'main' of https://barefacedgit.ddnss.de/tsindt/simply_cpq 2026-09-14 08:52:58 +02:00
tsindt c62aa67220 Test 2026-09-14 08:52:52 +02:00
tsindt 4960f8c5fd data 2026-09-14 08:47:08 +02:00
tsindt 6ec1fb2816 start implementing dataimport 2026-09-13 09:41:34 +02:00
tsindt 76db8d4cfe Testdaten 2026-09-12 23:09:17 +02:00
tsindt d1e210d03e Templates mit HTMX 2026-09-09 21:31:08 +02:00
tsindt 870a3cf708 Merge branch 'main' of https://barefacedgit.ddnss.de/tsindt/simply_cpq 2026-09-09 19:39:04 +02:00
tsindt 48b3f97298 Templates 2026-09-09 19:37:55 +02:00
tsindt c7e3778073 Form for editing property type details 2026-09-08 22:22:24 +02:00
tsindt 1d3cfdc7b7 Form 2026-09-08 21:15:02 +02:00
tsindt 441e218428 Design and layout updates for X-CPQ Material Editor interface 2026-09-03 23:14:59 +02:00
tsindt 30b1f09cdf Tree view und CSS refinement 2026-09-03 21:37:28 +02:00
tsindt 88e89307c4 Bugfix: Adjust navigation styling and layout 2026-09-02 23:53:18 +02:00
tsindt b32c11ff6d Styles 2026-09-02 23:51:39 +02:00
tsindt 8a622906bb redesign from scratch 2026-09-02 21:12:24 +02:00
tsindt 80135f8690 redesign user interface for better usability 2026-09-02 13:43:41 +02:00
tsindt 4743fff3d4 Refactor property type repository methods and update references in property types group repository 2026-09-01 22:49:44 +02:00
tsindt 61c6c11142 repository: Add image_url field to property and property_type models 2026-09-01 20:46:41 +02:00
tsindt 60b056d430 Merge branch 'main' of https://barefacedgit.ddnss.de/tsindt/simply_cpq 2026-09-01 13:50:31 +02:00
tsindt 7c775d4e9f kleiner korrekturen 2026-08-31 19:58:13 +02:00
69 changed files with 7909 additions and 177 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}"
}
]
}
@@ -0,0 +1,211 @@
[
{
"name": "X-CPQ",
"description": "Property Type Group for X-CPQ",
"property_type_Groups": [
{
"name": "electrical",
"description": "All electrical property types",
"property_types": [
{
"name": "Spannungsversorgung (V)",
"description": "Spannungsversorgung (V)",
"values": [
{ "value": 220 },
{ "value": 230 }
]
},
{
"name": "Leistung (W)",
"description": "Leistung",
"values": [
{ "value": 0 },
{ "value": 140 },
{ "value": 130 },
{ "value": 120 },
{ "value": 110 },
{ "value": 100 },
{ "value": 90 },
{ "value": 80 },
{ "value": 70 },
{ "value": 60 },
{ "value": 50 },
{ "value": 28 },
{ "value": 26 },
{ "value": 24 },
{ "value": 22 },
{ "value": 20 }
]
},
{
"name": "Eingangsimpedanz (Ω)",
"description": "Wiederstand der Eingangsimpedanz",
"values": [
{ "value": 10 }
]
},
{
"name": "Frequenzbereich (Hz‑kHz)",
"description": "Frequenzbereich (Hz‑kHz)",
"values": [
{ "value": "87‑108" }
]
},
{
"name": "Signal‑Rausch‑Verhältnis (dB)",
"description": "Signal‑Rausch‑Verhältnis (dB)",
"values": [
{ "value": 48 },
{ "value": 46 },
{ "value": 47 },
{ "value": 45 },
{ "value": 49 },
{ "value": 44 }
]
},
{
"name": "Anschlüsse",
"description": "Anschlüsse",
"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 (Ω)",
"values": [
{ "value": 75 }
]
}
]
},
{
"name": "mechanical",
"description": "All mechanical properties",
"property_types": [
{
"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",
"values": [
{ "value": 3 },
{ "value": 6 },
{ "value": 4 },
{ "value": 2 }
]
},
{
"name": "Kapazität (kg)",
"description": "All mechanical properties",
"values": [
{ "value": 0 }
]
},
{
"name": "Programms/Features",
"description": "All mechanical properties",
"values": []
},
{
"name": "Wasserverbrauch pro Zyklus (L)",
"description": "All mechanical properties",
"values": []
},
{
"name": "Material Innenraum",
"description": "All mechanical properties",
"values": []
},
{
"name": "Kapazität/Volumen (L)",
"description": "All mechanical properties",
"values": []
},
{
"name": "Schleuderdrehzahl (U/min)",
"description": "All mechanical properties",
"values": []
}
]
},
{
"name": "other",
"description": "All other properties",
"property_types": [
{
"name": "Preis (USD)",
"description": "All other properties",
"values": []
},
{
"name": "Zusatzfunktionen",
"description": "All other properties",
"values": []
},
{
"name": "Bedienungsart",
"description": "All other properties",
"values": []
},
{
"name": "Energieeffizienzklasse",
"description": "All other properties",
"values": []
}
]
}
]
}
]
@@ -1,6 +1,7 @@
[{
"label": "Simply CPQ",
"description": "Property Type Group for Simply CPQ",
[
{
"label": "X-CPQ",
"description": "Property Type Group for X-CPQ",
"propertyTypeGroups": [
{
"label": "electrical",
@@ -8,31 +9,81 @@
"propertyTypes": [
{
"label": "Spannungsversorgung (V)",
"description": "Spannungsversorgung (V)"
"description": "Spannungsversorgung (V)",
"values": [
220,
230
]
},
{
"label": "Leistung (W)",
"description": "Leistung"
"description": "Leistung",
"values": [
0,
140,
130,
120,
110,
100,
90,
80,
70,
60,
50,
28,
26,
24,
22,
20
]
},
{
"label": "Eingangsimpedanz (Ω)",
"description": "Wiederstand der Eingangsimpedanz"
"description": "Wiederstand der Eingangsimpedanz",
"values": [
10
]
},
{
"label": "Frequenzbereich (Hz‑kHz)",
"description": "Frequenzbereich (Hz‑kHz)"
"description": "Frequenzbereich (Hz‑kHz)",
"values": [
"87‑108"
]
},
{
"label": "Signal‑Rausch‑Verhältnis (dB)",
"description": "Signal‑Rausch‑Verhältnis (dB)"
"description": "Signal‑Rausch‑Verhältnis (dB)",
"values": [
48,
46,
47,
45,
49,
44
]
},
{
"label": "Anschlüsse",
"description": "Anschlüsse"
"description": "Anschlüsse",
"values": [
"UKW+Bluetooth+DL",
"UKW+Wi‑Fi+DL",
"UKW+DL+Bluetooth",
"UKW+Bluetooth+Wi‑Fi",
"UKW+Wi‑Fi+DL",
"UKW+Wi‑Fi",
"UKW+Bluetooth",
"UKW+DL",
"UKW"
]
},
{
"label": "Ausgangsimpedanz (Ω)",
"description": "Ausgangsimpedanz (Ω)"
"description": "Ausgangsimpedanz (Ω)",
"values": [
75
]
}
]
},
@@ -42,34 +93,90 @@
"propertyTypes": [
{
"label": "Abmessungen (mm)",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": [
"158x88x33",
"310x210x110",
"160x90x35",
"170x100x42",
"150x80x30",
"155x85x32",
"165x95x38",
"305x205x105",
"172x102x44",
"340x240x140",
"420x320x140",
"162x92x36",
"300x200x100",
"168x98x40",
"315x215x115",
"325x225x125",
"415x315x135",
"320x220x120",
"335x235x135",
"330x230x130",
"400x300x120",
"405x305x125",
"345x245x145",
"295x245x135",
"410x310x130",
"290x240x130",
"285x235x125",
"280x230x120",
"275x225x115",
"270x220x110",
"265x215x105",
"255x205x95",
"260x210x100",
"250x200x90",
"445x345x165",
"440x340x160",
"435x335x155",
"430x330x150",
"425x325x145"
]
},
{
"label": "Gewicht (kg)",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": [
3,
6,
4,
2
]
},
{
"label": "Kapazität (kg)",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": [
0
]
},
{
"label": "Programms/Features",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": []
},
{
"label": "Wasserverbrauch pro Zyklus (L)",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": []
},
{
"label": "Material Innenraum",
"description": "All mechanical properties"
} {
"description": "All mechanical properties",
"values": []
},
{
"label": "Kapazität/Volumen (L)",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": []
},
{
"label": "Schleuderdrehzahl (U/min)",
"description": "All mechanical properties"
"description": "All mechanical properties",
"values": []
}
]
},
@@ -79,19 +186,26 @@
"propertyTypes": [
{
"label": "Preis (USD)",
"description": "All other properties"
"description": "All other properties",
"values": []
},
{
"label": "Zusatzfunktionen",
"description": "All other properties"
}, {
"description": "All other properties",
"values": []
},
{
"label": "Bedienungsart",
"description": "All other properties"
}, {
"description": "All other properties",
"values": []
},
{
"label": "Energieeffizienzklasse",
"description": "All other properties"
"description": "All other properties",
"values": []
}
]
}
]
}
]
}]
+10 -8
View File
@@ -34,18 +34,20 @@ go get github.com/gin-contrib/cors
go get github.com/gin-contrib/sessions
````
##### Go Air
Go Air ist ein Live-Reload-Tool für Go-Anwendungen, das die Entwicklungsproduktivität erhöht.
````
go install github.com/air-verse/air@latest
export PATH="$PATH:$(go env GOPATH)/bin"
````
Den Export ggf. in der .bashrc oder .zshrc hinzufügen.
#### HTML Erweiterungen
ggf. später lokal runter laden ...
##### Tailwind und DaisyUI
Tailwind ist ein CSS Framework, das die Erstellung von Webseiten erleichtert. DaisyUI ist eine Erweiterung von Tailwind, die zusätzliche Komponenten bereitstellt.
````
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
````
##### HTMX
HTMX ist eine JavaScript-Bibliothek, die es ermöglicht, HTML direkt über AJAX-Anfragen zu aktualisieren.
@@ -4,6 +4,9 @@ import (
"database/sql"
"log"
"net/http"
"xcpq_editor/internal/handlers"
"xcpq_editor/internal/repositories"
"xcpq_editor/internal/services"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
@@ -14,24 +17,60 @@ type HttpServer struct {
config *viper.Viper
router *gin.Engine
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 {
// db initialization can be done here if needed
// 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:
importService := services.NewImportService(importRepository)
propertyTypesService := services.NewPropertyTypeService(propertyTypeRepository, propertyTypeGroupRepository)
// controller initialisation:
// handler initialisation:
importHandler := handlers.NewImportHandler(importService)
propertyTypesHandler := handlers.NewPropertyTypesHandler(propertyTypesService)
// Service API
router := gin.Default()
// initialize templates
router.LoadHTMLGlob("../templates/**/*.html")
router.Use(cors.Default())
// static content
router.Static("/static", "../static")
router.StaticFile("/", "../static/index.html")
router.GET("/", handlers.Home)
router.GET("/properties", handlers.PropertiesHandler)
// properties
router.GET("/properties/rootnodes", propertyTypesHandler.GetRootPropertyTypesGroups)
router.GET("/properties/:id/childs", propertyTypesHandler.GetPropertyTypesGroupDirectChildsById)
/*
router.GET("/products", handlers.ProductsHandler)
router.GET("/conditions", handlers.ConditionsHandler)
router.GET("/translations", handlers.TranslationsHandler)
*/
// import
router.POST("/importPropertyTypes", importHandler.ImportPropertyTypeGroups)
// test endpoint
router.GET("/test", Test)
// server
@@ -39,6 +78,12 @@ func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
config: config,
router: router,
dbHandler: dbHandler,
importHandler: importHandler,
importRepository: importRepository,
valueRepository: valueRepository,
propertyRepository: propertyRepository,
propertyTypeRepository: propertyTypeRepository,
propertyTypeGroupRepository: propertyTypeGroupRepository,
}
}
@@ -0,0 +1 @@
exit status 1
Binary file not shown.
@@ -0,0 +1,286 @@
[
{
"name": "X-CPQ",
"description": "Property Type Group for X-CPQ",
"property_types_Groups": [
{
"name": "electrical",
"description": "All electrical property types",
"property_types": [
{
"name": "Spannungsversorgung (V)",
"description": "Spannungsversorgung (V)",
"property": {
"name": "Spannungsversorgung (V)",
"description": "Spannungsversorgung (V)",
"values": [
{ "value": "220" },
{ "value": "230" }
]
}
},
{
"name": "Leistung (W)",
"description": "Leistung",
"property": {
"name": "Leistung (W)",
"description": "Leistung",
"values": [
{ "value": "0" },
{ "value": "140" },
{ "value": "130" },
{ "value": "120" },
{ "value": "110" },
{ "value": "100" },
{ "value": "90" },
{ "value": "80" },
{ "value": "70" },
{ "value": "60" },
{ "value": "50" },
{ "value": "28" },
{ "value": "26" },
{ "value": "24" },
{ "value": "22" },
{ "value": "20" }
]
}
},
{
"name": "Eingangsimpedanz (Ω)",
"description": "Wiederstand der Eingangsimpedanz",
"property": {
"name": "Eingangsimpedanz (Ω)",
"description": "Wiederstand der Eingangsimpedanz",
"values": [
{ "value": "10" }
]
}
},
{
"name": "Frequenzbereich (Hz‑kHz)",
"description": "Frequenzbereich (Hz‑kHz)",
"property": {
"name": "Frequenzbereich (Hz‑kHz)",
"description": "Frequenzbereich (Hz‑kHz)",
"values": [
{ "value": "87‑108" }
]
}
},
{
"name": "Signal‑Rausch‑Verhältnis (dB)",
"description": "Signal‑Rausch‑Verhältnis (dB)",
"property": {
"name": "Signal‑Rausch‑Verhältnis (dB)",
"description": "Signal‑Rausch‑Verhältnis (dB)",
"values": [
{ "value": "48" },
{ "value": "46" },
{ "value": "47" },
{ "value": "45" },
{ "value": "49" },
{ "value": "44" }
]
}
},
{
"name": "Anschlüsse",
"description": "Anschlüsse",
"property": {
"name": "Anschlüsse",
"description": "Anschlüsse",
"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": []
}
}
]
}
]
}
]
@@ -0,0 +1,44 @@
package handlers
import (
"log"
"net/http"
"xcpq_editor/internal/models"
"xcpq_editor/internal/services"
"github.com/gin-gonic/gin"
)
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
var importData []models.Property_Types_Group
if err := ctx.ShouldBindJSON(&importData); err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
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{
"message": "Import successful",
})
}
@@ -0,0 +1,48 @@
package handlers
import (
"html/template"
"net/http"
"github.com/gin-gonic/gin"
)
func Home(ctx *gin.Context) {
tmpl, err := template.ParseFiles(
"../templates/pages/index.html",
"../templates/layouts/navbar.html",
"../templates/layouts/properties.html",
"../templates/layouts/footer.html")
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
err = tmpl.Execute(ctx.Writer, nil)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
}
}
func PropertiesHandler(ctx *gin.Context) {
ptmpl, err := template.ParseFiles(
"../templates/layouts/properties.html")
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
err = ptmpl.Execute(ctx.Writer, nil)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
}
}
@@ -0,0 +1,67 @@
package handlers
import (
"log"
"net/http"
"strconv"
"xcpq_editor/internal/services"
"github.com/gin-gonic/gin"
)
type PropertyTypesHandler struct {
propertyTypeService *services.PropertyTypeService
}
func NewPropertyTypesHandler(propertyTypeService *services.PropertyTypeService) *PropertyTypesHandler {
return &PropertyTypesHandler{
propertyTypeService: propertyTypeService,
}
}
func (h *PropertyTypesHandler) GetRootPropertyTypesGroups(ctx *gin.Context) {
rootGroups, err := h.propertyTypeService.GetRootPropertyTypesGroups()
if rootGroups == nil {
ctx.JSON(http.StatusNotFound, gin.H{"error": "No root property types groups found"})
return
}
// If there was an error but rootGroups is not nil, we still want to return the data
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
// execute template
log.Printf("Rendering root property types groups template with data")
ctx.HTML(http.StatusOK, "ptg_treeNode", rootGroups)
log.Printf("Rendered root property types groups template successfully")
}
func (h *PropertyTypesHandler) GetPropertyTypesGroupDirectChildsById(ctx *gin.Context) {
idParam := ctx.Param("id")
id, err := strconv.Atoi(idParam)
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "Invalid ID"})
return
}
propertyTypesGroup, err := h.propertyTypeService.GetPropertyTypesGroupWithDirectChildsById(id)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
if propertyTypesGroup == nil {
ctx.JSON(http.StatusNotFound, gin.H{"error": "Property types group not found"})
return
}
log.Printf("Rendering direct child property types groups template for property types group with ID %d", id)
log.Printf("Direct child property types groups for property types group with ID %d: %v", id, propertyTypesGroup.Property_Types_Groups)
log.Printf("Direct child property types groups for property types with ID %d: %v", id, propertyTypesGroup.Property_Types)
// execute template
ctx.HTML(http.StatusOK, "ptg_treeNode", propertyTypesGroup.Property_Types_Groups)
}
@@ -3,5 +3,7 @@ package models
type Product struct {
Id int
Name string
Description string
Image_Url string
Properties []Property
}
@@ -0,0 +1,9 @@
package models
type Product_Group struct {
Id int `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"`
Properties []Property `json:"properties,omitempty"`
}
@@ -1,9 +1,13 @@
package models
type Property struct {
Id int
Name string
Description string
Parent_Property *Property
Values []Value
Id int `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"`
//Property_Type *Property_Type `json:"property_type,omitempty"`
Parent_Property *Property `json:"parent_property,omitempty"`
Products_Group *Product_Group `json:"products_group,omitempty"`
Product *Product `json:"products,omitempty"`
Values []Value `json:"values,omitempty"`
}
@@ -1,8 +1,9 @@
package models
type Property_Type struct {
Id int
Name string
Description string
Property Property
Id int `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"`
Property Property `json:"property"`
}
@@ -1,9 +1,10 @@
package models
type Property_Types_Group struct {
Id int
Name string
Description string
Property_Types []Property_Type
Property_Types_Groups []Property_Types_Group
Id int `json:"id,omitempty"`
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,6 +1,7 @@
package models
type Value struct {
Id int
Value string
Id int `json:"id,omitempty"`
Value string `json:"value"`
Image_Url string `json:"image_url,omitempty"`
}
@@ -0,0 +1,52 @@
package repositories
import (
"database/sql"
"xcpq_editor/internal/models"
)
type Import_Repository struct {
db *sql.DB
vr *Value_Repository
pt *Property_Type_Repository
ptg *Property_Types_Group_Repository
pr *Property_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{
db: db,
vr: vr,
pt: pt,
ptg: ptg,
pr: pr,
}
}
func (r *Import_Repository) ImportPropertyTypesData(newGroup *models.Property_Types_Group, parentGroup *models.Property_Types_Group) error {
// Implement the import logic here
if newGroup.Id == 0 {
/**
* If the root ID is 0, it means the root property types group is not yet persisted.
* Implement the logic to handle this case, e.g., insert the root group into the database.
*/
group, err := r.ptg.CreatePropertyTypesGroup(newGroup, parentGroup)
if err != nil {
return err
}
newGroup.Id = group.Id
for _, childPropertyType := range newGroup.Property_Types {
_, err := r.pt.CreatePropertyType(&childPropertyType, newGroup, &childPropertyType.Property)
if err != nil {
return err
}
}
for _, childGroup := range newGroup.Property_Types_Groups {
err := r.ImportPropertyTypesData(&childGroup, newGroup)
if err != nil {
return err
}
}
}
return nil
}
@@ -2,6 +2,7 @@ package repositories
import (
"database/sql"
"log"
"xcpq_editor/internal/models"
)
@@ -45,8 +46,8 @@ func (pr *Property_Repository) CreateProperty(
parent_property_id = 0
}
query := `INSERT INTO properties (name, description, parent_property_id, property_type_id, product_id) VALUES ($1, $2, $3, $4, $5) RETURNING id`
err := pr.db.QueryRow(query, property.Name, property.Description, parent_property_id, property_type_id, product_id).Scan(&property.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)
if err != nil {
return nil, err
}
@@ -65,18 +66,87 @@ func (pr *Property_Repository) CreateProperty(
product.Properties = append(product.Properties, *property)
}
for _, value := range property.Values {
v, err := pr.vr.CreateValueForPropertyId(property.Id, &value)
if err != nil {
return nil, err
}
value = *v
}
return property, nil
}
func (pr *Property_Repository) GetPropertyById(id int) (*models.Property, error) {
// Implement the logic to retrieve a property by its ID from the database
query := `SELECT id, name, description, parent_property_id FROM properties WHERE id = $1`
query := `SELECT id, name, description, parent_property_id, image_url FROM properties.properties WHERE id = $1`
property := &models.Property{}
log.Printf("Repository: Retrieving property with ID %d", id)
var parent_property_id int
err := pr.db.QueryRow(query, id).Scan(&property.Id, &property.Name, &property.Description, &parent_property_id)
err := pr.db.QueryRow(query, id).Scan(&property.Id, &property.Name, &property.Description, &parent_property_id, &property.Image_Url)
if err != nil {
return nil, err
}
if parent_property_id != 0 {
parent_property, err := pr.GetPropertyById(parent_property_id)
if err == nil {
property.Parent_Property = parent_property
log.Printf("Repository: Appending parent property with ID %d to property with ID %d", parent_property.Id, property.Id)
}
} else {
property.Parent_Property = nil
}
valuePtrs, err := pr.vr.GetValuesFromPropertyId(property.Id)
if err != nil {
return property, err
}
property.Values = make([]models.Value, 0, len(valuePtrs))
for _, value := range valuePtrs {
if value != nil {
property.Values = append(property.Values, *value)
}
}
return property, nil
}
func (pr *Property_Repository) UpdateProperty(property *models.Property) error {
// Implement the logic to update an existing property in the database
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)
return err
}
func (pr *Property_Repository) DeleteProperty(id int) error {
// Implement the logic to delete a property from the database
// First, delete all values associated with the property
err := pr.vr.DeleteValuesFromPropertyId(id)
if err != nil {
return err
}
query := `DELETE FROM properties.properties WHERE id=$1`
_, err = pr.db.Exec(query, id)
return err
}
func (pr *Property_Repository) GetPropertyByPropertyType(property_type *models.Property_Type) (*models.Property, error) {
// Implement the logic to retrieve a property by its property type ID from the database
query := `SELECT id, name, description, parent_property_id, products_groups_id, products_id, image_url
FROM properties.properties
WHERE property_type_id = $1`
property := &models.Property{}
var parent_property_id int
var products_groups_id int
var products_id int
err := pr.db.QueryRow(query, property_type.Id).Scan(&property.Id, &property.Name, &property.Description, &parent_property_id, &products_groups_id, &products_id, &property.Image_Url)
if err != nil {
return nil, err
}
if parent_property_id != 0 {
parent_property, err := pr.GetPropertyById(parent_property_id)
if err == nil {
@@ -100,23 +170,3 @@ func (pr *Property_Repository) GetPropertyById(id int) (*models.Property, error)
return property, nil
}
func (pr *Property_Repository) UpdateProperty(property *models.Property) error {
// Implement the logic to update an existing property in the database
query := `UPDATE properties SET name=$1, description=$2 WHERE id=$3`
_, err := pr.db.Exec(query, property.Name, property.Description, property.Id)
return err
}
func (pr *Property_Repository) DeleteProperty(id int) error {
// Implement the logic to delete a property from the database
// First, delete all values associated with the property
err := pr.vr.DeleteValuesFromPropertyId(id)
if err != nil {
return err
}
query := `DELETE FROM properties WHERE id=$1`
_, err = pr.db.Exec(query, id)
return err
}
@@ -2,6 +2,7 @@ package repositories
import (
"database/sql"
"log"
"xcpq_editor/internal/models"
)
@@ -29,8 +30,8 @@ func (ptr *Property_Type_Repository) CreatePropertyType(
} else {
property_type_group_id = 0
}
query := `INSERT INTO property_types (name, description, property_type_group_id) VALUES ($1, $2, $3) RETURNING id`
err := ptr.db.QueryRow(query, property_type.Name, property_type.Description, property_type_group_id).Scan(&property_type.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)
if err != nil {
return nil, err
}
@@ -50,27 +51,32 @@ func (ptr *Property_Type_Repository) CreatePropertyType(
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
query := "SELECT id, name, description 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{}
err := ptr.db.QueryRow(query, id).Scan(&property_type.Id, &property_type.Name, &property_type.Description)
err := ptr.db.QueryRow(query, id).Scan(&property_type.Id, &property_type.Name, &property_type.Description, &property_type.Image_Url)
if err != nil {
return nil, err
}
property, err := ptr.pr.GetPropertyById(property_type.Id)
log.Printf("Repository: Retrieved property type with ID %d", property_type.Id)
property, err := ptr.pr.GetPropertyByPropertyType(property_type)
if err != nil {
return nil, err
}
log.Printf("Repository: Retrieved property with ID %d for property type with ID %d", property.Id, property_type.Id)
property_type.Property = *property
return property_type, nil
}
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
query := `UPDATE property_types SET name=$1, description=$2 WHERE id=$3`
_, err := ptr.db.Exec(query, property_type.Name, property_type.Description, property_type.Id)
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)
return err
}
func (ptr *Property_Type_Repository) DeletePropertyType(id int) error {
func (ptr *Property_Type_Repository) DeletePropertyTypeById(id int) error {
// 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)
return err
}
@@ -0,0 +1,239 @@
package repositories
import (
"database/sql"
"log"
"xcpq_editor/internal/models"
)
type Property_Types_Group_Repository struct {
db *sql.DB
property_Type_Repository *Property_Type_Repository
}
func NewPropertyTypesGroupRepository(db *sql.DB, property_Type_Repository *Property_Type_Repository) *Property_Types_Group_Repository {
return &Property_Types_Group_Repository{
db: db,
property_Type_Repository: property_Type_Repository,
}
}
func (ptrg *Property_Types_Group_Repository) CreatePropertyTypesGroup(property_types_group *models.Property_Types_Group, parentPropertyTypeGroup *models.Property_Types_Group) (*models.Property_Types_Group, error) {
// Implement the logic to create a new property types group in the database
var parentId int
if parentPropertyTypeGroup != nil {
parentId = parentPropertyTypeGroup.Id
parentPropertyTypeGroup.Property_Types_Groups = append(parentPropertyTypeGroup.Property_Types_Groups, *property_types_group)
} else {
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 = []models.Property_Type{}
}
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)
if err != nil {
return nil, err
}
return property_types_group, nil
}
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
query := "SELECT id, name, description, image_url FROM properties.property_types_groups WHERE id = $1"
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)
if err != nil {
return nil, err
}
// get all property
queryProperties := "SELECT id FROM properties.property_types WHERE property_types_groups_id = $1"
rowsProperties, err := ptrg.db.Query(queryProperties, id)
if err != nil {
return nil, err
}
defer rowsProperties.Close()
for rowsProperties.Next() {
id := 0
err := rowsProperties.Scan(&id)
if err != nil {
return nil, err
}
log.Printf("Retrieved property type with ID %d for property types group with ID %d", id, property_types_group.Id)
property, err := ptrg.property_Type_Repository.GetPropertyTypeById(id)
if err != nil {
return nil, err
}
log.Printf("Appending property type with ID %d to property types group with ID %d", property.Id, property_types_group.Id)
property_types_group.Property_Types = append(property_types_group.Property_Types, *property)
}
return property_types_group, nil
}
func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupWithDirectChildsById(id int) (*models.Property_Types_Group, error) {
// Implement the logic to retrieve a property types group by its ID from the database
property_types_group, err := ptrg.GetPropertyTypesGroupById(id)
if err != nil {
return nil, err
}
// get all childs
queryChilds := "SELECT id FROM properties.property_types_groups WHERE parent_property_type_group_id = $1"
rows, err := ptrg.db.Query(queryChilds, id)
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
id := 0
err := rows.Scan(&id)
if err != nil {
return nil, err
}
child, err := ptrg.GetPropertyTypesGroupById(id)
if err != nil {
return nil, err
}
property_types_group.Property_Types_Groups = append(property_types_group.Property_Types_Groups, *child)
}
return property_types_group, nil
}
func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupDirectChildGroupsById(id int) ([]*models.Property_Types_Group, error) {
// get all childs
queryChilds := "SELECT id FROM properties.property_types_groups WHERE parent_property_type_group_id = $1"
rows, err := ptrg.db.Query(queryChilds, id)
if err != nil {
return nil, err
}
defer rows.Close()
property_Types_Groups := []*models.Property_Types_Group{}
for rows.Next() {
id := 0
err := rows.Scan(&id)
if err != nil {
return nil, err
}
child, err := ptrg.GetPropertyTypesGroupById(id)
if err != nil {
return nil, err
}
property_Types_Groups = append(property_Types_Groups, child)
}
return property_Types_Groups, nil
}
func (ptrg *Property_Types_Group_Repository) GetPropertyTypesGroupPropertyTypesById(id int) ([]*models.Property_Type, error) {
// get all property
queryProperties := "SELECT id FROM properties.property_types WHERE property_types_groups_id = $1"
rowsProperties, err := ptrg.db.Query(queryProperties, id)
if err != nil {
return nil, err
}
defer rowsProperties.Close()
property_Types := []*models.Property_Type{}
for rowsProperties.Next() {
id := 0
err := rowsProperties.Scan(&id)
if err != nil {
return nil, err
}
property, err := ptrg.property_Type_Repository.GetPropertyTypeById(id)
if err != nil {
return nil, err
}
property_Types = append(property_Types, property)
}
return property_Types, nil
}
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
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)
return err
}
func (ptrg *Property_Types_Group_Repository) DeletePropertyTypesGroup(id int) error {
// Implement the logic to delete a property types group from the database
query := `DELETE FROM properties.property_types_groups WHERE id=$1`
_, err := ptrg.db.Exec(query, id)
// delete all child property types groups
queryChilds := "SELECT id FROM properties.property_types_groups WHERE parent_property_type_group_id = $1"
rows, err := ptrg.db.Query(queryChilds, id)
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
childId := 0
err := rows.Scan(&childId)
if err != nil {
return err
}
err = ptrg.DeletePropertyTypesGroup(childId)
if err != nil {
return err
}
}
// delete all property types in this group
queryProperties := "SELECT id FROM properties.property_types WHERE property_types_groups_id = $1"
rowsProperties, err := ptrg.db.Query(queryProperties, id)
if err != nil {
return err
}
defer rowsProperties.Close()
for rowsProperties.Next() {
propertyId := 0
err := rowsProperties.Scan(&propertyId)
if err != nil {
return err
}
err = ptrg.property_Type_Repository.DeletePropertyTypeById(propertyId)
if err != nil {
return err
}
}
return err
}
func (ptrg *Property_Types_Group_Repository) GetRootPropertyTypesGroups() ([]*models.Property_Types_Group, error) {
query := "SELECT id FROM properties.property_types_groups WHERE parent_property_type_group_id = 0"
rows, err := ptrg.db.Query(query)
if err != nil {
log.Printf("Error querying root property types groups: %v", err)
return nil, err
}
defer rows.Close()
var rootGroups []*models.Property_Types_Group
for rows.Next() {
id := 0
err := rows.Scan(&id)
if err != nil {
return nil, err
}
log.Printf("Loading root property types group with ID: %d", id)
group, err := ptrg.GetPropertyTypesGroupById(id)
if err != nil {
log.Printf("Error loading root property types group with ID: %d: %v", id, err)
return nil, err
}
rootGroups = append(rootGroups, group)
}
log.Printf("Loaded %d root property types groups", len(rootGroups))
return rootGroups, nil
}
@@ -17,8 +17,8 @@ func NewValueRepository(db *sql.DB) *Value_Repository {
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
query := `INSERT INTO values (propertyid, value) VALUES ($1, $2) RETURNING id`
err := vr.db.QueryRow(query, propertyId, value.Value).Scan(&value.Id)
query := `INSERT INTO properties.values (properties_id, value, image_url) VALUES ($1, $2, $3) RETURNING id`
err := vr.db.QueryRow(query, propertyId, value.Value, value.Image_Url).Scan(&value.Id)
if err != nil {
return nil, err
}
@@ -27,24 +27,24 @@ func (vr *Value_Repository) CreateValueForPropertyId(propertyId int, value *mode
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
query := `DELETE FROM values WHERE id=$1 AND propertyid=$2`
query := `DELETE FROM properties.values WHERE id=$1 AND properties_id=$2`
_, err := vr.db.Exec(query, valueId, propertyId)
return err
}
func (vr *Value_Repository) UpdateValue(value *models.Value) error {
// Implement the logic to update the value in the database for the given valueId
query := `UPDATE values SET value=$1 WHERE id=$2`
_, err := vr.db.Exec(query, value.Value, value.Id)
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)
return err
}
func (vr *Value_Repository) GetValue(id int) (*models.Value, error) {
// Implement the logic to retrieve a value by its ID from the database
query := "SELECT id, value FROM values WHERE id = $1"
query := "SELECT id, value, image_url FROM properties.values WHERE id = $1"
row := vr.db.QueryRow(query, id)
value := &models.Value{}
err := row.Scan(&value.Id, &value.Value)
err := row.Scan(&value.Id, &value.Value, &value.Image_Url)
if err != nil {
return nil, err
}
@@ -53,14 +53,14 @@ func (vr *Value_Repository) GetValue(id int) (*models.Value, error) {
func (vr *Value_Repository) DeleteValuesFromPropertyId(propertyId int) error {
// 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 properties_id=$1`
_, err := vr.db.Exec(query, propertyId)
return err
}
func (vr *Value_Repository) GetValuesFromPropertyId(propertyId int) ([]*models.Value, error) {
// Implement the logic to retrieve all values from the database for the given propertyId
query := `SELECT id, value FROM values WHERE propertyid=$1`
query := `SELECT id, value, image_url FROM properties.values WHERE properties_id=$1`
rows, err := vr.db.Query(query, propertyId)
if err != nil {
return nil, err
@@ -70,7 +70,7 @@ func (vr *Value_Repository) GetValuesFromPropertyId(propertyId int) ([]*models.V
values := []*models.Value{}
for rows.Next() {
value := &models.Value{}
err := rows.Scan(&value.ID, &value.Value)
err := rows.Scan(&value.Id, &value.Value, &value.Image_Url)
if err != nil {
return nil, err
}
@@ -0,0 +1,20 @@
package services
import (
"xcpq_editor/internal/models"
"xcpq_editor/internal/repositories"
)
type Import_Service struct {
importRepository *repositories.Import_Repository
}
func NewImportService(importRepository *repositories.Import_Repository) *Import_Service {
return &Import_Service{
importRepository: importRepository,
}
}
func (s *Import_Service) ImportPropertyTypesData(newGroup *models.Property_Types_Group, parentGroup *models.Property_Types_Group) error {
return s.importRepository.ImportPropertyTypesData(newGroup, parentGroup)
}
@@ -0,0 +1,63 @@
package services
import (
"log"
"xcpq_editor/internal/models"
"xcpq_editor/internal/repositories"
)
type PropertyTypeService struct {
// Add any dependencies or fields needed for the service here
property_Types_Repository *repositories.Property_Type_Repository
property_Types_Groups_Repository *repositories.Property_Types_Group_Repository
}
func NewPropertyTypeService(propertyTypesRepo *repositories.Property_Type_Repository, propertyTypesGroupsRepo *repositories.Property_Types_Group_Repository) *PropertyTypeService {
return &PropertyTypeService{
property_Types_Repository: propertyTypesRepo,
property_Types_Groups_Repository: propertyTypesGroupsRepo,
}
}
func (s *PropertyTypeService) GetRootPropertyTypesGroups() ([]*models.Property_Types_Group, error) {
var rootGroups []*models.Property_Types_Group
var err error
rootGroupsTemp, err := s.property_Types_Groups_Repository.GetRootPropertyTypesGroups()
if err != nil {
return nil, err
}
for i := range rootGroupsTemp {
rootGroups = append(rootGroups, rootGroupsTemp[i])
}
log.Printf("Service Loaded %d root property types groups", len(rootGroups))
return rootGroups, nil
}
func (s *PropertyTypeService) GetPropertyTypesGroupWithDirectChildsById(id int) (*models.Property_Types_Group, error) {
propertyTypesGroup, err := s.property_Types_Groups_Repository.GetPropertyTypesGroupWithDirectChildsById(id)
if err != nil {
return nil, err
}
log.Printf("Service Loaded property types group with ID %d", propertyTypesGroup.Id)
return propertyTypesGroup, nil
}
func (s *PropertyTypeService) GetPropertyTypesGroupDirectChildGroupsById(id int) ([]*models.Property_Types_Group, error) {
childGroups, err := s.property_Types_Groups_Repository.GetPropertyTypesGroupDirectChildGroupsById(id)
if err != nil {
return nil, err
}
log.Printf("Service Loaded %d direct child property types groups for property types group with ID %d", len(childGroups), id)
return childGroups, nil
}
func (s *PropertyTypeService) GetPropertyTypesGroupPropertyTypesById(id int) ([]*models.Property_Type, error) {
propertyTypes, err := s.property_Types_Groups_Repository.GetPropertyTypesGroupPropertyTypesById(id)
if err != nil {
return nil, err
}
log.Printf("Service Loaded %d property types for property types group with ID %d", len(propertyTypes), id)
return propertyTypes, nil
}
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@@ -236,6 +236,10 @@
</ul>
</div>
</div>
<div id="content">
<h3 class="text-2xl font-bold mb-4">Eigenschaften</h3>
<p>Damit in allen Produkten bei der Pflege von Eigenschaften keine Missverständnisse entstehen, gibt es bei X-CPQ einen Eigenschaften-Pool. In diesem Pool werden alle zu verwendenen Eigenschaften und deren Wertebereiche in Form von Properties und deren mögliche Werte in Form von Listen spezifiziert. Diese Properties können fachlich noch in sog. Property-Groups eingeordnet werden. Z.B. kann ich eine Eigenschaft "Farbe" definieren, die die Werte "Rot, Grün und Blau" annehmen kann. Jedem Produkt, bei welchem ich eine Eigenschaft "Farbe" habe, weise ich dann dieses Property zu nud schrenke bei Bedarf den Wertebereich ein, z.B. bei einem blauen Produkt auf "Blau". Damit verhinde ich, dass es für gleichartige Eigenschaften unterschiedliche Begriffe verwendet werden, z.B. "Farbe", "Farbton" und "Ton" bedeuten eigentlich das gleiche.</p>
</div>
</div>
</article>
</div>
@@ -245,7 +249,7 @@
<footer class="footer sm:footer-horizontal footer-center bg-base-300 text-base-content p-4 mt-5 shadow-sm rounded-box">
<aside>
<p>Copyright © 2026 - All right reserved by Simply CPQ/p>
<p>Copyright © 2026 - All right reserved by Simply CPQ</p>
</aside>
</footer>
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,103 @@
/** layout Main Bereich */
main {
padding: var(--main-content-padding);
margin: 16px;
height: calc(100vh - var(--header-height) - var(--footer-height) - 4 * var(--main-content-padding) - 64px);
/* 32px für die Margen */
overflow-y: auto;
/* Scrollbar, wenn der Inhalt zu groß ist */
border: 1px solid var(--secondary-color);
border-radius: var(--box-border-radius);
}
.editor-container {
height: calc(100vh - var(--header-height) - var(--footer-height) - 4 * var(--main-content-padding) - 132px);
display: flex;
flex-direction: row;
/* Elemente horizontal anordnen */
gap: 16px;
/* Abstand zwischen den Elementen */
padding: 16px;
/* Innenabstand */
border-radius: var(--box-border-radius);
background-color: var(--data-background-color);
}
.editor-view {
margin-top: 8px;
padding: 8px;
border: 1px solid var(--primary-color);
border-radius: var(--box-border-radius);
}
/** tree components */
.node {
justify-content: center;
list-style-type: none;
/* Entfernt die Standard-Aufzählungszeichen */
padding-left: 20px;
/* Einrückung für die Unterlisten */
}
.node img {
height: 12px;
/* Höhe des Bildes */
margin-right: 2px;
/* Abstand zwischen Bild und Text */
}
.leaf {
padding-left: 20px;
/* Einrückung für Blätter */
color: var(--primary-color);
font-weight: lighter;
}
/* form styles */
.cform {
display: flex;
flex-direction: column;
color: var(--primary-color);
gap: 8px;
padding: 16px;
}
.cform label {
padding-top: 8px;
}
.cform input[type="text"],
.cform textarea {
padding: 4px;
border: 1px solid var(--primary-color);
border-radius: var(--box-border-radius);
}
/* Style für allgemeine Elemente */
.box {
border: 1px solid var(--primary-color);
border-radius: var(--box-border-radius);
}
.button_row {
display: flex;
flex-direction: row;
justify-content: flex-end;
gap: 8px;
margin-top: 8px;
}
.button_row button {
padding: 4px 8px;
border: 1px solid var(--primary-color);
border-radius: var(--box-border-radius);
background-color: var(--data-background-color);
cursor: pointer;
display: inline-flex;
justify-content: center;
}
.mt-16 {
margin-top: 16px;
}
@@ -0,0 +1,11 @@
/** footer styles */
footer {
height: var(--footer-height);
background-color: var(--primary-color);
border: 1px solid var(--secondary-color);
border-radius: var(--box-border-radius);
color: var(--secondary-font-color);
margin: 16px;
padding: 10px;
}
@@ -0,0 +1,43 @@
/** global styles */
/* globale Variablen */
:root {
/* colors */
--primary-color: #1976D2;
--secondary-color: #d27519;
--font-color: #333333;
--secondary-font-color: #f3f5f4;
--background-color: #f3f5f4;
--highlight-color: #f0f0f0;
--error-color: #ff4d4f;
--success-color: #52c41a;
--data-background-color: #ffffff;
/* Dimensions */
--header-height: 32px;
--footer-height: 32px;
--main-content-padding: 20px;
--box-border-radius: 10px;
}
/* 1. Schriftart definieren */
@font-face {
font-family: 'Inter'; /* Name, den du später im CSS verwendest */
src: url('/static/fonts/Inter.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
* {
margin: 0;
padding: 0;
}
/* 2. Schriftart anwenden und Ränder entfernen*/
body {
font-family: 'Inter', Arial, sans-serif;
background-color: var(--background-color);
color: var(--font-color);
}
@@ -0,0 +1,48 @@
/** Header and included nav styles */
/* Style für Header, Navigation, Main Content, Aside und Footer */
header {
display: flex;
justify-content: flex-start;
align-items: center;
height: var(--header-height);
background-color: var(--primary-color);
border: 1px solid var(--secondary-color);
border-radius: var(--box-border-radius);
color: var(--secondary-font-color);
margin: 16px;
padding: 10px;
}
header img {
height: calc(var(--header-height) - 5px); /* Adjust the image height to fit within the header */
margin-left: 10px; /* Space between the image and the header text */
padding-right: 16px; /* Space between the image and the header text */
}
header p {
font-weight: 100;
margin-left: 16px;
padding-right: 16px;
}
nav {
margin: 16px;
padding: 10px;
}
nav ul {
list-style-type: none; /* Entfernt die Standard-Aufzählungszeichen */
display: flex; /* Macht die Liste horizontal */
gap: 20px; /* Abstand zwischen den Listenelementen */
}
nav ul li a {
text-decoration: none; /* Entfernt die Unterstreichung */
color: var(--secondary-font-color); /* Setzt die Schriftfarbe */
}
nav ul li a:hover {
text-decoration: underline; /* Unterstreichung beim Überfahren mit der Maus */
font-weight: bold; /* Macht den Text fett */
}
Binary file not shown.
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1976D2"><path d="M280-280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h400q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H280Zm0-80h400q50 0 85-35t35-85q0-50-35-85t-85-35H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm42-28 142-142-42-42-100 100-40-40-42 42 82 82Zm158-92Z"/></svg>

After

Width:  |  Height:  |  Size: 378 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1976D2"><path d="M348.5-291.5Q360-303 360-320t-11.5-28.5Q337-360 320-360t-28.5 11.5Q280-337 280-320t11.5 28.5Q303-280 320-280t28.5-11.5Zm0-160Q360-463 360-480t-11.5-28.5Q337-520 320-520t-28.5 11.5Q280-497 280-480t11.5 28.5Q303-440 320-440t28.5-11.5Zm0-160Q360-623 360-640t-11.5-28.5Q337-680 320-680t-28.5 11.5Q280-657 280-640t11.5 28.5Q303-600 320-600t28.5-11.5ZM440-280h240v-80H440v80Zm0-160h240v-80H440v80Zm0-160h240v-80H440v80ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>

After

Width:  |  Height:  |  Size: 695 B

@@ -0,0 +1,4 @@
{{define "footer"}}
<!-- Footer content can be added here -->
<p>&copy; 2026 Simply CPQ by Dr. Thomas Sindt</p>
{{end}}
@@ -0,0 +1,16 @@
{{define "navbar"}}
<img src="/static/images/SimplyCPQ_Logo.svg" alt="Simply CPQ Logo" />
<h1>X-CPQ Material Editor</h1>
<p>by Simply CPQ</p>
<nav>
<!-- Navigation links can be added here -->
<ul>
<li><a href="#" hx-get="/properties" hx-target="#main-content">Eigenschaften</a></li>
<li><a href="#" hx-get="/products" hx-target="#main-content">Produkte</a></li>
<li><a href="#" hx-get="/conditions" hx-target="#main-content">Konditionen</a></li>
<li><a href="#" hx-get="/translations" hx-target="#main-content">Übersetzungen</a></li>
<li><a href="#">Datenimporte</a></li>
</ul>
</nav>
{{end}}
@@ -0,0 +1,93 @@
<!-- Properties content can be added here -->
<h2>X-CPQ Material Editor: Eigenschaften</h2>
<!-- Main content can be added here -->
<p>Der Eigenschaftspool dient der globalen Definition von Eigenschaften.</p>
<div class="editor-container">
<section class="editor-view">
<h3>Property Type Groups</h3>
<ul class="node mt-16" hx-get="/properties/rootnodes" hx-trigger="click" hx-target="#PropertyTypeGroupList" hx-swap="outerHTML">
<details close>
<summary>
X-CPQ-Eigenschaften
</summary>
<div id="PropertyTypeGroupList">
<!-- Property type groups will be dynamically loaded here -->
</div>
</details>
</ul>
<!--
<ul class="node mt-16">
<details open>
<summary>
X-CPQ-Eigenschaften
</summary>
<ul class="node">
<details open>
<summary>
Systemeigenschaften
</summary>
<ul class="node">
<li class="leaf">
Eigenschaft 1
</li>
<li class="leaf">
Eigenschaft 2
</li>
</ul>
</details>
<details open>
<summary>
Catalog Eigenschaften
</summary>
<ul class="node">
<li class="leaf">
Eigenschaft 1
</li>
<li class="leaf">
Eigenschaft 2
</li>
</ul>
</details>
<li class="leaf">
Eigenschaft 1
</li>
<li class="leaf">
Eigenschaft 2
</li>
</ul>
</details>
</ul>
-->
</section>
<section class="editor-view">
<section id="PropertyTypeGroupData">
<h3>Property-Type Group {PropertyTypeGroupName}</h3>
<form class="cform" method="post" action="/updatePropertyTypeGroup">
<label for="propertyTypeGroupName">Name:</label>
<input type="text" id="propertyTypeGroupName" name="propertyTypeGroupName" value="{PropertyTypeGroupName}">
<label for="propertyTypeGroupDescription">Beschreibung:</label>
<textarea id="propertyTypeGroupDescription" name="propertyTypeGroupDescription">{PropertyTypeGroupDescription}</textarea>
<div class="button_row">
<button type="submit">Speichern</button>
<button type="submit">Neu</button>
<button type="submit">Löschen</button>
</div>
</form>
</section>
<section id="PropertyTypeData">
<h3>Property-Type {PropertyTypeName}</h3>
<p>Hier können die Details der ausgewählten Eigenschaft bearbeitet werden.</p>
<!-- Editor content can be added here -->
</section>
</section>
<section class="editor-view">
<section id="ValueData">
<h3>Values für {PropertyTypeName}</h3>
<p>Hier können die Werte der ausgewählten Eigenschaft bearbeitet werden.</p>
<!-- Editor content can be added here -->
</section>
</section>
</div>
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="/static/images/SimplyCPQ_Logo.svg" />
<title>X-CPQ by Simply CPQ</title>
<link rel="stylesheet" href="/static/css/scpq_header.css">
<link rel="stylesheet" href="/static/css/scpq_global.css">
<link rel="stylesheet" href="/static/css/scpq_content.css">
<link rel="stylesheet" href="/static/css/scpq_footer.css">
<script src="/static/js/htmx.js"></script>
</head>
<body>
<header>
{{ template "navbar" . }}
</header>
<main>
<section id="main-content">
<h1>Bitte einen Bereich in der Navigation auswählen</h1>
</section>
</main>
<footer>
{{ template "footer" . }}
</footer>
</body>
</html>
@@ -0,0 +1,21 @@
{{define "ptg_treeNode"}}
{{range .}}
<ul class="node" hx-get="/properties/{{.Id}}/childs" hx-trigger="click" hx-target="#node-{{.Id}}" hx-swap="outerHTML">
<details closed>
<summary>
{{.Name}}
</summary>
<div id="node-{{.Id}}">Keine Informationen vorhanden
</div>
<!--
{{template "ptg_treeNode" .Property_Types_Groups}}
<ul class="node">
{{range .Property_Types}}
<li>{{.Name}}</li>
{{end}}
</ul>
-->
</details>
</ul>
{{end}}
{{end}}
@@ -0,0 +1,18 @@
{{define "ptg_treeNode"}}
{{- range .}}
<ul class="node" hx-get="/properties/{{.Id}}/childs" hx-trigger="click" hx-target="#node-{{.Id}}" hx-swap="outerHTML">
<details closed>
<summary>
{{.Name}}
</summary>
<div id="node-{{.Id}}">Keine Informationen vorhanden
</div>
<ul class="node">
{{range .Property_Types}}
<li>{{.Name}}</li>
{{end}}
</ul>
</details>
</ul>
{{- end}}
{{end}}
Binary file not shown.
+329
View File
@@ -0,0 +1,329 @@
--
-- PostgreSQL database dump
--
\restrict GIC3drewyMgulrEtIK7aSkXSq2vxnkXYUQhmWYUZdn3fSeyrHHRbtaWNqN975Kg
-- Dumped from database version 18.4 (Debian 18.4-1.pgdg13+1)
-- Dumped by pg_dump version 18.6
-- Started on 2026-09-13 09:15:21 CEST
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-13 09:15:22 CEST
--
-- PostgreSQL database dump complete
--
\unrestrict GIC3drewyMgulrEtIK7aSkXSq2vxnkXYUQhmWYUZdn3fSeyrHHRbtaWNqN975Kg
+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