From 7691b87c0e9e0fc2024a137a625b70e84f526cd7 Mon Sep 17 00:00:00 2001 From: areeqakbr Date: Mon, 30 Jun 2025 09:49:57 +0700 Subject: [PATCH] addinng olt --- model/dto/res/device_details.go | 2 ++ utils/helper/device_details.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/model/dto/res/device_details.go b/model/dto/res/device_details.go index b3eebe3..9fc486c 100644 --- a/model/dto/res/device_details.go +++ b/model/dto/res/device_details.go @@ -27,6 +27,8 @@ type DeviceDetailsResponse struct { ImageURL *string `json:"image_url,omitempty"` ImageURLs []string `json:"image_urls"` TowerID *uuid.UUID `json:"tower_id,omitempty"` // Add TowerID + OLTID *uuid.UUID `json:"olt_id"` // Add OLTID + OLTName *string `json:"olt_name"` // Add OLT name // Connection details Backbones []BackboneConnectionInfo `json:"backbones"` diff --git a/utils/helper/device_details.go b/utils/helper/device_details.go index f2c4da2..b459f73 100644 --- a/utils/helper/device_details.go +++ b/utils/helper/device_details.go @@ -200,6 +200,12 @@ func ConvertToDeviceDetailsResponse(device entity.DeviceDetails, geocoder servic allImageURLs = []string{} // Return empty array instead of nil } + // Handle OLT information + var oltName *string + if device.OLT != nil && device.OLT.OLTName != "" { + oltName = &device.OLT.OLTName + } + response := res.DeviceDetailsResponse{ ID: device.ID, DeviceCode: device.DeviceCode, @@ -220,6 +226,8 @@ func ConvertToDeviceDetailsResponse(device entity.DeviceDetails, geocoder servic ImageURLs: allImageURLs, TowerID: device.TowerID, // Keep TowerID for reference // Remove AssignedTower field - now everything is in Towers + OLTID: device.OLTID, // Add OLTID + OLTName: oltName, // Add OLT name Backbones: backboneInfos, Fishbones: fishboneInfos, Towers: towerInfos, // All towers combined here