Add telemetry registration

This commit is contained in:
2025-12-29 23:04:08 +01:00
parent 32f3050d96
commit ca40197b4a
6 changed files with 143 additions and 9 deletions

View File

@@ -0,0 +1,31 @@
package be.naaturel.boardmateapi.services;
import be.naaturel.boardmateapi.common.exceptions.ServiceException;
import be.naaturel.boardmateapi.common.models.TelemetryData;
import be.naaturel.boardmateapi.repository.TelemetryRepo;
import be.naaturel.boardmateapi.repository.dtos.TelemetryDataDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class TelemetryService {
private final TelemetryRepo repo;
@Autowired
public TelemetryService(TelemetryRepo repo){
this.repo = repo;
}
public void insert(TelemetryData telemetry) throws ServiceException {
try{
TelemetryDataDto dto = new TelemetryDataDto();
dto.setClientId(telemetry.getClientId());
dto.setData(telemetry.getData());
repo.insert(dto);
} catch (Exception e){
throw new ServiceException("Failed to add telemetry data : " + e.getMessage());
}
}
}