diff --git a/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java b/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java index 2138b8789b0b..395932a7157a 100644 --- a/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java +++ b/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java @@ -94,15 +94,16 @@ private PyrisLectureUnitWebhookDTO processAttachmentForUpdate(AttachmentUnit att String courseTitle = attachmentUnit.getLecture().getCourse().getTitle(); String courseDescription = attachmentUnit.getLecture().getCourse().getDescription() == null ? "" : attachmentUnit.getLecture().getCourse().getDescription(); String base64EncodedPdf = attachmentToBase64(attachmentUnit); + String lectureUnitLink = artemisBaseUrl + attachmentUnit.getAttachment().getLink(); lectureUnitRepository.save(attachmentUnit); - return new PyrisLectureUnitWebhookDTO(base64EncodedPdf, lectureUnitId, lectureUnitName, lectureId, lectureTitle, courseId, courseTitle, courseDescription); + return new PyrisLectureUnitWebhookDTO(base64EncodedPdf, lectureUnitId, lectureUnitName, lectureId, lectureTitle, courseId, courseTitle, courseDescription, lectureUnitLink); } private PyrisLectureUnitWebhookDTO processAttachmentForDeletion(AttachmentUnit attachmentUnit) { Long lectureUnitId = attachmentUnit.getId(); Long lectureId = attachmentUnit.getLecture().getId(); Long courseId = attachmentUnit.getLecture().getCourse().getId(); - return new PyrisLectureUnitWebhookDTO("", lectureUnitId, "", lectureId, "", courseId, "", ""); + return new PyrisLectureUnitWebhookDTO("", lectureUnitId, "", lectureId, "", courseId, "", "", ""); } /** diff --git a/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/lectureingestionwebhook/PyrisLectureUnitWebhookDTO.java b/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/lectureingestionwebhook/PyrisLectureUnitWebhookDTO.java index b2f2cde1019d..90985390a40a 100644 --- a/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/lectureingestionwebhook/PyrisLectureUnitWebhookDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/lectureingestionwebhook/PyrisLectureUnitWebhookDTO.java @@ -8,6 +8,7 @@ * providing necessary details such as lecture and course identifiers, names, and descriptions. */ @JsonInclude(JsonInclude.Include.NON_EMPTY) + public record PyrisLectureUnitWebhookDTO(String pdfFile, long lectureUnitId, String lectureUnitName, long lectureId, String lectureName, long courseId, String courseName, - String courseDescription) { + String courseDescription, String lectureUnitLink) { } diff --git a/src/test/java/de/tum/cit/aet/artemis/iris/PyrisConnectorServiceTest.java b/src/test/java/de/tum/cit/aet/artemis/iris/PyrisConnectorServiceTest.java index 67f18be698ef..6d0b38315e04 100644 --- a/src/test/java/de/tum/cit/aet/artemis/iris/PyrisConnectorServiceTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/iris/PyrisConnectorServiceTest.java @@ -52,7 +52,7 @@ void testExceptionV2(int httpStatus, Class exceptionClass) { void testExceptionIngestionV2(int httpStatus, Class exceptionClass) { irisRequestMockProvider.mockIngestionWebhookRunError(httpStatus); PyrisLectureUnitWebhookDTO pyrisLectureUnitWebhookDTO = new PyrisLectureUnitWebhookDTO("example.pdf", 123L, "Lecture Unit Name", 456L, "Lecture Name", 789L, "Course Name", - "Course Description"); + "Course Description", "/example/test.pdf"); PyrisWebhookLectureIngestionExecutionDTO executionDTO = new PyrisWebhookLectureIngestionExecutionDTO(pyrisLectureUnitWebhookDTO, null, List.of()); assertThatThrownBy(() -> pyrisConnectorService.executeLectureAddtionWebhook("fullIngestion", executionDTO)).isInstanceOf(exceptionClass); }