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 {
.map(answer -> {
var builder = ReplyNachricht.builder()
.id(rueckfrage.getId())
.antwortId(answer.getRueckfrageId())
.nachrichtEventId(id)
.message(answer.getAnswerText())
.attachments(getAttachments(answer.getAttachmentFileId(), answer.getRueckfrageId(), id));
......
......@@ -34,6 +34,22 @@ import lombok.Builder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Builder(toBuilder = true)
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")
@Schema(description = "The id of the postfach",
name = "postfachId",
......@@ -48,14 +64,6 @@ record ReplyNachricht(
example = "60af924b4f1a2560298b4567"
)
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.",
name = "message",
type = "string",
......@@ -73,6 +81,7 @@ record ReplyNachricht(
"postfachId='" + postfachId + '\'' +
", nachrichtEventId='" + nachrichtEventId + '\'' +
", id='" + id + '\'' +
", antwortId='" + antwortId + '\'' +
", attachments=" + attachments +
", message=<...masked for privacy..>" +
'}';
......
......@@ -40,6 +40,7 @@ public class AntragraumproxyGrpcRueckfrageTestFactory {
public static final String VORGANG_ID = UUID.randomUUID().toString();
public static final String VORGANG_NAME = NachrichtTestFactory.VORGANG_TITLE;
public static final String ANSWER_FILE_ID = UUID.randomUUID().toString();
public static final String ANSWER_ID = UUID.randomUUID().toString();
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 erat,
......@@ -91,6 +92,7 @@ public class AntragraumproxyGrpcRueckfrageTestFactory {
static AntragraumproxyGrpcRueckfrageAnswer createRueckfrageAnswer() {
var antwort = new AntragraumproxyGrpcRueckfrageAnswer();
antwort.setRueckfrageId(ANSWER_ID);
antwort.setAnswerText(ANSWER_TEXT);
antwort.setSentAt(SEND_AT);
antwort.setAttachmentFileId(List.of(ANSWER_FILE_ID));
......
......@@ -179,6 +179,13 @@ class NachrichtMapperTest {
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
void shouldMapAnswerNachrichtText() {
var nachricht = mapper.fromRestRueckfrage(answeredRueckfrage, NachrichtTestFactory.NACHRICHT_EVENT_ID);
......
......@@ -23,7 +23,8 @@ package de.ozgcloud.antragsraum.nachricht;
public class ReplyNachrichtTestFactory {
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";
static ReplyNachricht create() {
......@@ -33,6 +34,7 @@ public class ReplyNachrichtTestFactory {
static ReplyNachricht.ReplyNachrichtBuilder createBuilder() {
return ReplyNachricht.builder()
.id(ID)
.antwortId(ANTWORT_ID)
.nachrichtEventId(NACHRICHT_EVENT_ID)
.postfachId(NachrichtTestFactory.POSTFACH_ID)
.message(TEXT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment