Skip to content

Commit

Permalink
changes dates to iso strings (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasinge authored Jun 25, 2020
1 parent c2fd7b9 commit 9ded405
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/main/java/com/redhat/labs/omp/model/CreationDetails.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.redhat.labs.omp.model;

import java.time.LocalDateTime;

import javax.json.bind.annotation.JsonbProperty;

import lombok.AllArgsConstructor;
Expand All @@ -20,6 +18,6 @@ public class CreationDetails {
@JsonbProperty("created_by_email")
private String createdByEmail;
@JsonbProperty("created_on")
private LocalDateTime createdOn;
private String createdOn;

}
4 changes: 1 addition & 3 deletions src/main/java/com/redhat/labs/omp/model/Launch.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.redhat.labs.omp.model;

import java.time.LocalDateTime;

import javax.json.bind.annotation.JsonbProperty;

import lombok.AllArgsConstructor;
Expand All @@ -16,7 +14,7 @@
public class Launch {

@JsonbProperty("launched_date_time")
private LocalDateTime launchedDateTime;
private String launchedDateTime;
@JsonbProperty("launched_by")
private String launchedBy;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.redhat.labs.omp.service;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -271,7 +272,7 @@ public Engagement launch(Engagement engagement) {
}

// create new launch data for engagement
engagement.setLaunch(Launch.builder().launchedDateTime(LocalDateTime.now())
engagement.setLaunch(Launch.builder().launchedDateTime(ZonedDateTime.now(ZoneId.of("Z")).toString())
.launchedBy(engagement.getLastUpdateByName()).build());

// update db
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/redhat/labs/omp/service/GitSyncService.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.redhat.labs.omp.service;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.List;

import javax.enterprise.context.ApplicationScoped;
Expand Down Expand Up @@ -61,8 +62,7 @@ void consumeDbRefreshRequestedEvent(BackendEvent event) {

}).subscribe().with(item -> {
// create refresh event
BackendEvent refreshDbEvent = BackendEvent.createDatabaseRefreshEvent(item,
event.isForceUpdate());
BackendEvent refreshDbEvent = BackendEvent.createDatabaseRefreshEvent(item, event.isForceUpdate());
// send event to bus for processing
eventBus.sendAndForget(refreshDbEvent.getEventType().getEventBusAddress(), refreshDbEvent);
}, failure -> {
Expand Down Expand Up @@ -174,7 +174,8 @@ private void setCreationDetails(Engagement engagement) {

// set creation details
CreationDetails creationDetails = CreationDetails.builder().createdByUser(engagement.getLastUpdateByName())
.createdByEmail(engagement.getLastUpdateByEmail()).createdOn(LocalDateTime.now()).build();
.createdByEmail(engagement.getLastUpdateByEmail())
.createdOn(ZonedDateTime.now(ZoneId.of("Z")).toString()).build();
engagement.setCreationDetails(creationDetails);

}
Expand Down

0 comments on commit 9ded405

Please sign in to comment.