fix invite

This commit is contained in:
_Bastler 2021-12-07 08:49:17 +01:00
parent 83b21eee5c
commit 3886b6d3e0
2 changed files with 21 additions and 9 deletions

View File

@ -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);

View File

@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<revision>1.4.3-SNAPSHOT</revision>
<revision>1.4.4-SNAPSHOT</revision>
</properties>
<parent>