dev add tarriff description
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-15 15:41:24 +07:00
parent c0818146bc
commit afe78f74f2
@@ -85,9 +85,9 @@ public class TariffService {
public TariffDTO updateTariff(Long id, TariffDTO tariffDTO, TariffRequest tariffRequest) {
Tariff tariff = tariffRepository.findById(id)
.orElseThrow(() -> new TariffNotFoundException("Tariff not found"));
updateTariffFromDTO(tariff, tariffDTO, tariffRequest);
Tariff updateTariffFromDTO = updateTariffFromDTO(tariff, tariffDTO, tariffRequest);
return convertToDTO(tariffRepository.save(tariff));
return convertToDTO(tariffRepository.save(updateTariffFromDTO));
}
@Transactional
@@ -112,7 +112,7 @@ public class TariffService {
);
}
private void updateTariffFromDTO(Tariff tariff, TariffDTO dto, TariffRequest tariffRequest) {
private Tariff updateTariffFromDTO(Tariff tariff, TariffDTO dto, TariffRequest tariffRequest) {
tariff.setType(tariffRequest.getType() == null ? dto.getType(): tariffRequest.getType());
tariff.setName(tariffRequest.getName() == null ? dto.getName(): tariffRequest.getName());
tariff.setPrice(tariffRequest.getPrice() == 0 ? dto.getPrice(): tariffRequest.getPrice());
@@ -124,5 +124,7 @@ public class TariffService {
tariff.setDescription(tariffRequest.getDescription() == null ? dto.getDescription(): tariffRequest.getDescription());
tariff.setTariffTerm(tariffRequest.getTariffTerm() == null ? TariffTimeTerm.valueOf(dto.getTariffTerm().toUpperCase()):
TariffTimeTerm.valueOf(tariffRequest.getTariffTerm()));
return tariff;
}
}