-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#265: adopt backend to operate with timezone aware timestamps using U…
…TC to provide timezone aware timestamps in APIs to fix data times in user interface
- Loading branch information
Florian Gessner
committed
Dec 28, 2023
1 parent
fae0ace
commit 6a556a5
Showing
9 changed files
with
59 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
GET localhost:8080/api/email | ||
GET localhost:8080/api/emails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,16 @@ | |
import org.apache.commons.lang3.RandomStringUtils; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.time.LocalDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
class EmailControllerUtil { | ||
|
||
private EmailControllerUtil() { } | ||
|
||
public static Email prepareRandomEmail(int minusMinutes) { | ||
var randomToken = RandomStringUtils.randomAlphanumeric(6); | ||
var receivedOn = LocalDateTime.now().minusMinutes(minusMinutes); | ||
var receivedOn = getUtcNow().minusMinutes(minusMinutes); | ||
|
||
var content = new EmailContent(); | ||
content.setContentType(ContentType.PLAIN); | ||
|
@@ -31,7 +32,7 @@ public static Email prepareRandomEmail(int minusMinutes) { | |
|
||
public static Email prepareEmail(String subject, String toAdress, int minusMinutes) { | ||
var randomToken = RandomStringUtils.randomAlphanumeric(6); | ||
var receivedOn = LocalDateTime.now().minusMinutes(minusMinutes); | ||
var receivedOn = getUtcNow().minusMinutes(minusMinutes); | ||
|
||
var content = new EmailContent(); | ||
content.setContentType(ContentType.PLAIN); | ||
|
@@ -47,7 +48,7 @@ public static Email prepareEmail(String subject, String toAdress, int minusMinut | |
|
||
public static Email prepareEmail(String subject, String toAdress, int minusMinutes, String messageId) { | ||
var randomToken = RandomStringUtils.randomAlphanumeric(6); | ||
var receivedOn = LocalDateTime.now().minusMinutes(minusMinutes); | ||
var receivedOn = getUtcNow().minusMinutes(minusMinutes); | ||
|
||
var content = new EmailContent(); | ||
content.setContentType(ContentType.PLAIN); | ||
|
@@ -61,12 +62,16 @@ public static Email prepareEmail(String subject, String toAdress, int minusMinut | |
receivedOn, "[email protected]", toAdress, messageId); | ||
} | ||
|
||
private static ZonedDateTime getUtcNow() { | ||
return ZonedDateTime.now(ZoneId.of("UTC")); | ||
} | ||
|
||
public static Email prepareEmail( | ||
EmailAttachment emailAttachment, | ||
EmailContent emailContent, | ||
String subject, | ||
String rawData, | ||
LocalDateTime receivedOn, | ||
ZonedDateTime receivedOn, | ||
String fromAddress, | ||
String toAdress, | ||
String messageId) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters