From 3886b6d3e0e3859fe9f1f80df8d56b1a5b921529 Mon Sep 17 00:00:00 2001 From: _Bastler Date: Tue, 7 Dec 2021 08:49:17 +0100 Subject: [PATCH] fix invite --- .../businesslogic/InviteMappingManager.java | 28 +++++++++++++------ pom.xml | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/invite/src/main/java/de/bstly/we/invite/businesslogic/InviteMappingManager.java b/invite/src/main/java/de/bstly/we/invite/businesslogic/InviteMappingManager.java index f7cfdd8..a8fbc93 100644 --- a/invite/src/main/java/de/bstly/we/invite/businesslogic/InviteMappingManager.java +++ b/invite/src/main/java/de/bstly/we/invite/businesslogic/InviteMappingManager.java @@ -46,7 +46,7 @@ public class InviteMappingManager { /** * Gets the by item and quota. * - * @param item the item + * @param item the item * @param quota the quota * @return the by item and quota */ @@ -59,9 +59,9 @@ public class InviteMappingManager { /** * Gets the. * - * @param page the page - * @param size the size - * @param sortBy the sort by + * @param page the page + * @param size the size + * @param sortBy the sort by * @param descending the descending * @return the page */ @@ -73,9 +73,9 @@ public class InviteMappingManager { /** * Creates the. * - * @param quota the quota - * @param item the item - * @param starts the starts + * @param quota the quota + * @param item the item + * @param starts the starts * @param expires the expires * @return the invite mapping */ @@ -98,7 +98,8 @@ public class InviteMappingManager { */ public InviteMapping save(InviteMapping inviteMapping) { - for (Invite invite : inviteRepository.findAll(qInvite.item.eq(inviteMapping.getItem()))) { + for (Invite invite : inviteRepository.findAll(qInvite.item.eq(inviteMapping.getItem()) + .and(qInvite.quota.eq(inviteMapping.getQuota())))) { if (StringUtils.hasText(inviteMapping.getCodeLink())) { String codeLink = String.format(inviteMapping.getCodeLink(), invite.getCode()); if (!codeLink.equals(invite.getCodeLink())) { @@ -119,6 +120,17 @@ public class InviteMappingManager { invite.setUrl(null); inviteRepository.save(invite); } + + if (!invite.getStarts().equals(inviteMapping.getStarts())) { + invite.setStarts(inviteMapping.getStarts()); + inviteRepository.save(invite); + } + + if (!invite.getExpires().equals(inviteMapping.getExpires())) { + invite.setExpires(inviteMapping.getExpires()); + inviteRepository.save(invite); + } + } return inviteMappingRepository.save(inviteMapping); diff --git a/pom.xml b/pom.xml index b199dd7..162f3d4 100755 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ UTF-8 11 - 1.4.3-SNAPSHOT + 1.4.4-SNAPSHOT