Skip to content

Commit

Permalink
🚚 (#236): Move Mail record to commons
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Klaus committed Jan 16, 2025
1 parent 1f7e0bd commit 53b51b2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
package app.hopps.mailservice;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
package app.hopps.commons.mail;

import java.util.Arrays;
import java.util.Map;
import java.util.Objects;

public record Mail(String[] mailReceivers, MailTemplates templateId, Map<String, String> variables) {

private static final ObjectMapper objectMapper = new ObjectMapper();

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass())
Expand All @@ -27,14 +21,10 @@ public int hashCode() {

@Override
public String toString() {
try {
return objectMapper.writeValueAsString(this);
} catch (JsonProcessingException ignored) {
return "{" +
"mailReceivers: [" + String.join(",", mailReceivers) + "]," +
"templateId: " + templateId + ',' +
"variables: " + variables +
'}';
}
return "Mail{" +
"mailReceivers=" + Arrays.toString(mailReceivers) +
", templateId=" + templateId +
", variables=" + variables +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.hopps.mailservice;
package app.hopps.commons.mail;

public enum MailTemplates {
TEMP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package app.hopps.mailservice;

import app.hopps.commons.mail.Mail;
import app.hopps.commons.mail.MailTemplates;
import io.quarkus.mailer.MailTemplate;
import io.smallrye.mutiny.Uni;
import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package app.hopps.mailservice;

import app.hopps.commons.mail.Mail;
import app.hopps.commons.mail.MailTemplates;
import io.quarkus.mailer.MockMailbox;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package app.hopps.mailservice;

import app.hopps.commons.mail.Mail;
import app.hopps.commons.mail.MailTemplates;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test;

Expand Down

0 comments on commit 53b51b2

Please sign in to comment.