diff --git a/bot-app/src/main/resources/application.yaml b/bot-app/src/main/resources/application.yaml index 38c962b..5517a6c 100644 --- a/bot-app/src/main/resources/application.yaml +++ b/bot-app/src/main/resources/application.yaml @@ -22,7 +22,7 @@ telegram-config: bot-username: ${TELEGRAM_BOT_USERNAME} bot-token: ${TELEGRAM_BOT_TOKEN} gitlab-bot: - version: 0.0.3 Beta + version: 0.0.4 Beta person: telegram-id: ${TELEGRAM_PERSON_ID} token: ${GITLAB_PERSONAL_TOKEN} diff --git a/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java b/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java index 03e684b..a9c5a33 100644 --- a/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java +++ b/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java @@ -122,6 +122,14 @@ public class NoteParser { ) .collect(Collectors.toList()); + final Set newNoteIds = newNotes.stream().map(Task::getId).collect(Collectors.toSet()); + + final ExistsContainer existsNoteContainer = noteService.existsById(newNoteIds); + + if (existsContainer.getContainer() != null && !existsContainer.getContainer().isEmpty()) { + noteService.deleteAllById(existsNoteContainer.getContainer().stream().map(Note::getId).collect(Collectors.toSet())); + } + final List newTasks = taskService.createAll(newNotes); newTasks.forEach(task -> noteService.link(task.getId(), mergeRequest.getId())); }