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

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

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>