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
@@ -1,13 +1,25 @@
package handlers
import (
"log"
"net/http"
"xcpq_editor/internal/models"
"xcpq_editor/internal/services"
"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
var importData []models.Property_Types_Group
@@ -16,6 +28,16 @@ func ImportHandler_PropertyTypesGroup(ctx *gin.Context) {
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",
})