Skip to content
Snippets Groups Projects
Commit a0200162 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6949 extend replies by answer id

parent 559b347e
Branches
Tags
No related merge requests found
...@@ -104,6 +104,7 @@ class NachrichtMapper { ...@@ -104,6 +104,7 @@ class NachrichtMapper {
.map(answer -> { .map(answer -> {
var builder = ReplyNachricht.builder() var builder = ReplyNachricht.builder()
.id(rueckfrage.getId()) .id(rueckfrage.getId())
.antwortId(answer.getRueckfrageId())
.nachrichtEventId(id) .nachrichtEventId(id)
.message(answer.getAnswerText()) .message(answer.getAnswerText())
.attachments(getAttachments(answer.getAttachmentFileId(), answer.getRueckfrageId(), id)); .attachments(getAttachments(answer.getAttachmentFileId(), answer.getRueckfrageId(), id));
......
...@@ -34,6 +34,22 @@ import lombok.Builder; ...@@ -34,6 +34,22 @@ import lombok.Builder;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
@Builder(toBuilder = true) @Builder(toBuilder = true)
record ReplyNachricht( record ReplyNachricht(
@Size(max = 24, message = "An id is too long")
@Schema(description = "The id of the Rückfrage",
name = "id",
type = "string",
example = "66af924b4f1a2560298b45ab"
)
@NotEmpty
String id,
@Size(max = 24, message = "An id is too long")
@Schema(description = "The id of the Antwort",
name = "id",
type = "string",
example = "66af924b4f1a2560298b45ab"
)
@NotEmpty
String antwortId,
@Size(max = 36, message = "An id is too long") @Size(max = 36, message = "An id is too long")
@Schema(description = "The id of the postfach", @Schema(description = "The id of the postfach",
name = "postfachId", name = "postfachId",
...@@ -48,14 +64,6 @@ record ReplyNachricht( ...@@ -48,14 +64,6 @@ record ReplyNachricht(
example = "60af924b4f1a2560298b4567" example = "60af924b4f1a2560298b4567"
) )
String nachrichtEventId, String nachrichtEventId,
@Size(max = 24, message = "An id is too long")
@Schema(description = "The id of the Rückfrage",
name = "id",
type = "string",
example = "66af924b4f1a2560298b45ab"
)
@NotEmpty
String id,
@Schema(description = "The answer to the rueckfrage.", @Schema(description = "The answer to the rueckfrage.",
name = "message", name = "message",
type = "string", type = "string",
...@@ -73,6 +81,7 @@ record ReplyNachricht( ...@@ -73,6 +81,7 @@ record ReplyNachricht(
"postfachId='" + postfachId + '\'' + "postfachId='" + postfachId + '\'' +
", nachrichtEventId='" + nachrichtEventId + '\'' + ", nachrichtEventId='" + nachrichtEventId + '\'' +
", id='" + id + '\'' + ", id='" + id + '\'' +
", antwortId='" + antwortId + '\'' +
", attachments=" + attachments + ", attachments=" + attachments +
", message=<...masked for privacy..>" + ", message=<...masked for privacy..>" +
'}'; '}';
......
...@@ -40,6 +40,7 @@ public class AntragraumproxyGrpcRueckfrageTestFactory { ...@@ -40,6 +40,7 @@ public class AntragraumproxyGrpcRueckfrageTestFactory {
public static final String VORGANG_ID = UUID.randomUUID().toString(); public static final String VORGANG_ID = UUID.randomUUID().toString();
public static final String VORGANG_NAME = NachrichtTestFactory.VORGANG_TITLE; public static final String VORGANG_NAME = NachrichtTestFactory.VORGANG_TITLE;
public static final String ANSWER_FILE_ID = UUID.randomUUID().toString(); public static final String ANSWER_FILE_ID = UUID.randomUUID().toString();
public static final String ANSWER_ID = UUID.randomUUID().toString();
public static final String TEXT = """ public static final String TEXT = """
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
...@@ -91,6 +92,7 @@ public class AntragraumproxyGrpcRueckfrageTestFactory { ...@@ -91,6 +92,7 @@ public class AntragraumproxyGrpcRueckfrageTestFactory {
static AntragraumproxyGrpcRueckfrageAnswer createRueckfrageAnswer() { static AntragraumproxyGrpcRueckfrageAnswer createRueckfrageAnswer() {
var antwort = new AntragraumproxyGrpcRueckfrageAnswer(); var antwort = new AntragraumproxyGrpcRueckfrageAnswer();
antwort.setRueckfrageId(ANSWER_ID);
antwort.setAnswerText(ANSWER_TEXT); antwort.setAnswerText(ANSWER_TEXT);
antwort.setSentAt(SEND_AT); antwort.setSentAt(SEND_AT);
antwort.setAttachmentFileId(List.of(ANSWER_FILE_ID)); antwort.setAttachmentFileId(List.of(ANSWER_FILE_ID));
......
...@@ -179,6 +179,13 @@ class NachrichtMapperTest { ...@@ -179,6 +179,13 @@ class NachrichtMapperTest {
assertThat(nachricht.replyNachrichten()).isEmpty(); assertThat(nachricht.replyNachrichten()).isEmpty();
} }
@Test
void shouldMapAnswerNachrichtId() {
var nachricht = mapper.fromRestRueckfrage(answeredRueckfrage, NachrichtTestFactory.NACHRICHT_EVENT_ID);
assertThat(nachricht.replyNachrichten().getFirst().antwortId()).isEqualTo(AntragraumproxyGrpcRueckfrageTestFactory.ANSWER_ID);
}
@Test @Test
void shouldMapAnswerNachrichtText() { void shouldMapAnswerNachrichtText() {
var nachricht = mapper.fromRestRueckfrage(answeredRueckfrage, NachrichtTestFactory.NACHRICHT_EVENT_ID); var nachricht = mapper.fromRestRueckfrage(answeredRueckfrage, NachrichtTestFactory.NACHRICHT_EVENT_ID);
......
...@@ -23,7 +23,8 @@ package de.ozgcloud.antragsraum.nachricht; ...@@ -23,7 +23,8 @@ package de.ozgcloud.antragsraum.nachricht;
public class ReplyNachrichtTestFactory { public class ReplyNachrichtTestFactory {
public static final String ID = "60af924b4f1a2560298b4567"; public static final String ID = "60af924b4f1a2560298b4567";
public static final String NACHRICHT_EVENT_ID = "60af924b4f1a2560298b4567"; public static final String ANTWORT_ID = "60af924b4f1a2560298b4568";
public static final String NACHRICHT_EVENT_ID = "60af924b4f1a2560298b4569";
public static final String TEXT = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam"; public static final String TEXT = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam";
static ReplyNachricht create() { static ReplyNachricht create() {
...@@ -33,6 +34,7 @@ public class ReplyNachrichtTestFactory { ...@@ -33,6 +34,7 @@ public class ReplyNachrichtTestFactory {
static ReplyNachricht.ReplyNachrichtBuilder createBuilder() { static ReplyNachricht.ReplyNachrichtBuilder createBuilder() {
return ReplyNachricht.builder() return ReplyNachricht.builder()
.id(ID) .id(ID)
.antwortId(ANTWORT_ID)
.nachrichtEventId(NACHRICHT_EVENT_ID) .nachrichtEventId(NACHRICHT_EVENT_ID)
.postfachId(NachrichtTestFactory.POSTFACH_ID) .postfachId(NachrichtTestFactory.POSTFACH_ID)
.message(TEXT); .message(TEXT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment