diff --git a/delivery/controller/device_details.go b/delivery/controller/device_details.go index adf043c..e45118e 100644 --- a/delivery/controller/device_details.go +++ b/delivery/controller/device_details.go @@ -455,6 +455,7 @@ func (c *DeviceDetailsController) updateDeviceDetails(ctx *gin.Context) { if city := ctx.PostForm("city"); city != "" { deviceUpdateDTO.City = &city } + if district := ctx.PostForm("district"); district != "" { deviceUpdateDTO.District = &district } @@ -469,6 +470,17 @@ func (c *DeviceDetailsController) updateDeviceDetails(ctx *gin.Context) { } } + + if oltIDStr := ctx.PostForm("olt_id"); oltIDStr != "" { + if oltID, err := uuid.Parse(oltIDStr); err == nil { + deviceUpdateDTO.OLTID = &oltID + } else { + common.ErrorResponses(ctx, http.StatusBadRequest, "Invalid OLT ID format") + return + } + } + + // Get multiple image files form := ctx.Request.MultipartForm imageFiles := form.File["images"] // Support multiple images diff --git a/model/dto/res/device_details.go b/model/dto/res/device_details.go index 4698588..f6a3fd7 100644 --- a/model/dto/res/device_details.go +++ b/model/dto/res/device_details.go @@ -39,8 +39,8 @@ type DeviceDetailsResponse struct { } type OLTInfo struct { - OLTID uuid.UUID `json:"olt_id"` - OLTName string `json:"olt_name"` + OLTID uuid.UUID `json:"id"` + OLTName string `json:"name"` } type TowerConnectionDetail struct { diff --git a/model/dto/res/olt.go b/model/dto/res/olt.go index a821808..bedbc9a 100644 --- a/model/dto/res/olt.go +++ b/model/dto/res/olt.go @@ -7,14 +7,14 @@ import ( type OLTResponse struct { ID uuid.UUID `json:"id"` - OLTName string `json:"olt_name"` + OLTName string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } type OLTDetailResponse struct { ID uuid.UUID `json:"id"` - OLTName string `json:"olt_name"` + OLTName string `json:"name"` DeviceCount int `json:"device_count"` Devices []DeviceDetailsResponse `json:"devices"` CreatedAt time.Time `json:"created_at"`