adding update fileds for olt on usecase
This commit is contained in:
parent
1374bfa4bf
commit
1f87bccbf4
|
|
@ -554,6 +554,21 @@ func (u *deviceDetailsUseCase) UpdateDeviceDetails(id uuid.UUID, deviceDTO req.U
|
|||
}
|
||||
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 {
|
||||
return errors.New("no fields to update")
|
||||
|
|
|
|||
Loading…
Reference in New Issue