Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPANTT-205] fix: Added missing set of field activationDate #523

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[PPANTT-205] added missing set of field activationDate and added mapp…
…ing in get station api response
gioelemella committed Nov 21, 2024
commit 4bd6eafc7a604c98f695bbd5963c30178510d174
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;

@@ -84,6 +85,7 @@ public StationService(
*/
public StationDetailResource createStation(@NotNull StationDetailsDto stationDetailsDto) {
StationDetails stationDetails = this.stationMapper.fromDto(stationDetailsDto);
stationDetails.setActivationDate(Instant.now());
this.apiConfigClient.createStation(stationDetails);

WrapperEntityStations response = this.wrapperService.updateValidatedWrapperStation(stationDetails, WrapperStatus.APPROVED);
@@ -361,6 +363,8 @@ private WrapperStations buildEnrichedWrapperStations(Stations stations) {
if (optionalWrapperEntities.isPresent()) {
WrapperEntityStations wrapperEntities = optionalWrapperEntities.get();
wrapperStation.setCreatedAt(wrapperEntities.getCreatedAt());
WrapperEntityStation mostRecentEntity = getStationWrapperEntityOperationsSortedList(wrapperEntities).get(0);
wrapperStation.setActivationDate(mostRecentEntity.getEntity().getActivationDate());
}
return wrapperStation;
}).toList();
@@ -385,6 +389,7 @@ private StationDetailResource buildActiveStationDetails(

WrapperEntityStation mostRecentEntity = getStationWrapperEntityOperationsSortedList(wrapperEntities).get(0);
stationDetailResource.setPendingUpdate(!WrapperStatus.APPROVED.equals(mostRecentEntity.getStatus()));
stationDetailResource.setActivationDate(mostRecentEntity.getEntity().getActivationDate());
} else {
stationDetailResource.setPendingUpdate(false);
}