adding update fileds for olt on usecase

This commit is contained in:
areeqakbr 2025-07-02 09:47:27 +07:00
parent 1374bfa4bf
commit 1f87bccbf4
1 changed files with 15 additions and 0 deletions

View File

@ -554,6 +554,21 @@ func (u *deviceDetailsUseCase) UpdateDeviceDetails(id uuid.UUID, deviceDTO req.U
} }
updates["tower_id"] = *deviceDTO.TowerID updates["tower_id"] = *deviceDTO.TowerID
} }
if deviceDTO.OLTID != nil {
// Validate OLT exists
oltExists, err := u.ValidateOLTExists(*deviceDTO.OLTID)
if err != nil {
return fmt.Errorf("failed to validate OLT: %w", err)
}
if !oltExists {
return fmt.Errorf("OLT with ID %s not found", deviceDTO.OLTID.String())
}
updates["olt_id"] = *deviceDTO.OLTID
}
log.Printf("Updating device %s with fields: %+v", id, updates)
if len(updates) == 0 { if len(updates) == 0 {
return errors.New("no fields to update") return errors.New("no fields to update")