new voucher system + jdoc

This commit is contained in:
2021-10-06 15:25:13 +02:00
parent 456332f24e
commit 442bdb4996
234 changed files with 4793 additions and 2737 deletions
@@ -26,8 +26,7 @@ import de.bstly.we.invite.repository.InviteRepository;
import de.bstly.we.model.UserData;
/**
* @author _bastler@bstly.de
*
* The Class InviteManager.
*/
@Component
public class InviteManager implements UserDataProvider {
@@ -42,28 +41,32 @@ public class InviteManager implements UserDataProvider {
private int codeLength;
/**
* @param id
* @return
* Gets the.
*
* @param id the id
* @return the invite
*/
public Invite get(Long id) {
return inviteRepository.findById(id).orElse(null);
}
/**
*
* @param owner
* @return
* Gets the all by owner.
*
* @param owner the owner
* @return the all by owner
*/
public List<Invite> getAllByOwner(Long owner) {
return Lists.newArrayList(inviteRepository.findAll(qInvite.owner.eq(owner)));
}
/**
*
* @param page
* @param size
* @param search
* @return
* Gets the.
*
* @param page the page
* @param size the size
* @param search the search
* @return the page
*/
public Page<Invite> get(int page, int size, String search) {
if (StringUtils.hasText(search)) {
@@ -74,23 +77,27 @@ public class InviteManager implements UserDataProvider {
}
/**
* @param id
* @return
* Gets the by code.
*
* @param code the code
* @return the by code
*/
public Invite getByCode(String code) {
return inviteRepository.findOne(qInvite.code.eq(code)).orElse(null);
}
/**
*
* @param owner
* @param item
* @param page
* @param size
* @param sortBy
* @param descending
* @param search
* @return
* Gets the by owner.
*
* @param owner the owner
* @param item the item
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @param search the search
* @param redeemed the redeemed
* @return the by owner
*/
public Page<Invite> getByOwner(Long owner, Integer item, int page, int size, String sortBy,
boolean descending, String search, String redeemed) {
@@ -120,12 +127,15 @@ public class InviteManager implements UserDataProvider {
}
/**
*
* @param page
* @param size
* @param sortBy
* @param descending
* @return
* Gets the others.
*
* @param owner the owner
* @param item the item
* @param page the page
* @param size the size
* @param search the search
* @param redeemed the redeemed
* @return the others
*/
public Page<Invite> getOthers(Long owner, int item, int page, int size, String search,
String redeemed) {
@@ -150,9 +160,10 @@ public class InviteManager implements UserDataProvider {
}
/**
*
* @param invite
* @return
* Save.
*
* @param invite the invite
* @return the invite
*/
public Invite save(Invite invite) {
if (!StringUtils.hasText(invite.getCode())) {
@@ -174,15 +185,16 @@ public class InviteManager implements UserDataProvider {
}
/**
*
* @param id
* Delete.
*
* @param id the id
*/
public void delete(Long id) {
inviteRepository.deleteById(id);
}
/**
*
* Delete all.
*/
public void deleteAll() {
inviteRepository.deleteAll();
@@ -21,8 +21,7 @@ import de.bstly.we.invite.repository.InviteMappingRepository;
import de.bstly.we.invite.repository.InviteRepository;
/**
* @author _bastler@bstly.de
*
* The Class InviteMappingManager.
*/
@Component
public class InviteMappingManager {
@@ -35,29 +34,33 @@ public class InviteMappingManager {
private QInvite qInvite = QInvite.invite;
/**
* @param id
* @return
* Gets the.
*
* @param quota the quota
* @return the invite mapping
*/
public InviteMapping get(String quota) {
return inviteMappingRepository.findById(quota).orElse(null);
}
/**
*
* @param item
* @return
* Gets the by item.
*
* @param item the item
* @return the by item
*/
public InviteMapping getByItem(int item) {
return inviteMappingRepository.findOne(qInviteMapping.item.eq(item)).orElse(null);
}
/**
*
* @param page
* @param size
* @param sortBy
* @param descending
* @return
* Gets the.
*
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the page
*/
public Page<InviteMapping> get(int page, int size, String sortBy, boolean descending) {
Sort sort = descending ? Sort.by(sortBy).descending() : Sort.by(sortBy).ascending();
@@ -65,12 +68,13 @@ public class InviteMappingManager {
}
/**
*
* @param owner
* @param room
* @param starts
* @param expires
* @return
* Creates the.
*
* @param quota the quota
* @param item the item
* @param starts the starts
* @param expires the expires
* @return the invite mapping
*/
public InviteMapping create(String quota, int item, Instant starts, Instant expires) {
Assert.isNull(get(quota), "ivite mapping for quota already exists");
@@ -84,9 +88,10 @@ public class InviteMappingManager {
}
/**
*
* @param inviteMapping
* @return
* Save.
*
* @param inviteMapping the invite mapping
* @return the invite mapping
*/
public InviteMapping save(InviteMapping inviteMapping) {
@@ -107,8 +112,9 @@ public class InviteMappingManager {
}
/**
*
* @param quota
* Delete.
*
* @param quota the quota
*/
public void delete(String quota) {
inviteMappingRepository.deleteById(quota);
@@ -49,8 +49,7 @@ import de.bstly.we.model.UserStatus;
import de.bstly.we.model.Visibility;
/**
* @author _bastler@bstly.de
*
* The Class InviteController.
*/
@RestController
@RequestMapping("/invites")
@@ -76,9 +75,10 @@ public class InviteController extends BaseController {
private UserProfileFieldValidator userProfileFieldValidator;
/**
*
* @param code
* @return
* Gets the.
*
* @param code the code
* @return the invite
*/
@GetMapping("/{code}")
public Invite get(@PathVariable("code") String code) {
@@ -112,8 +112,9 @@ public class InviteController extends BaseController {
}
/**
*
* @param userModel
* Register.
*
* @param userModel the user model
*/
@PostMapping
public void register(@RequestBody UserModel userModel) {
@@ -187,9 +188,16 @@ public class InviteController extends BaseController {
}
/**
*
* @param quotaParameter
* @return
* Gets the invites.
*
* @param quotaParameter the quota parameter
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param sortParamater the sort paramater
* @param descParameter the desc parameter
* @param searchParameter the search parameter
* @param redeemedParameter the redeemed parameter
* @return the invites
*/
@PreAuthorize("isAuthenticated()")
@GetMapping
@@ -215,12 +223,14 @@ public class InviteController extends BaseController {
}
/**
*
* @param quota
* @param page
* @param sizeParameter
* @param searchParameter
* @return
* Gets the other invites.
*
* @param quota the quota
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param searchParameter the search parameter
* @param redeemedParameter the redeemed parameter
* @return the other invites
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/{quota}/others")
@@ -252,10 +262,11 @@ public class InviteController extends BaseController {
}
/**
*
* @param quota
* @param inviteModel
* @return
* Creates the invite.
*
* @param quota the quota
* @param inviteModel the invite model
* @return the invite
*/
@PreAuthorize("isAuthenticated()")
@PostMapping("/{quota}")
@@ -302,9 +313,10 @@ public class InviteController extends BaseController {
}
/**
*
* @param inviteModel
* @return
* Update invite.
*
* @param inviteModel the invite model
* @return the invite
*/
@PreAuthorize("isAuthenticated()")
@PatchMapping
@@ -30,8 +30,7 @@ import de.bstly.we.invite.businesslogic.InviteMappingManager;
import de.bstly.we.invite.model.Invite;
/**
* @author _bastler@bstly.de
*
* The Class InviteManagingController.
*/
@RestController
@RequestMapping("/invites/manage")
@@ -43,10 +42,12 @@ public class InviteManagingController extends BaseController {
private InviteMappingManager inviteMappingManager;
/**
*
* @param page
* @param size
* @return
* Gets the invites.
*
* @param page the page
* @param size the size
* @param search the search
* @return the invites
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@GetMapping
@@ -57,9 +58,10 @@ public class InviteManagingController extends BaseController {
}
/**
*
* @param userModel
* @return
* Creates the or update.
*
* @param invite the invite
* @return the invite
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping
@@ -72,9 +74,10 @@ public class InviteManagingController extends BaseController {
}
/**
*
* @param invites
* @return
* Creates the or update list.
*
* @param invites the invites
* @return the list
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping("/list")
@@ -92,8 +95,9 @@ public class InviteManagingController extends BaseController {
}
/**
*
* @param id
* Delete.
*
* @param id the id
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping("/{id}")
@@ -105,8 +109,7 @@ public class InviteManagingController extends BaseController {
}
/**
*
* @param id
* Delete all.
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping
@@ -29,8 +29,7 @@ import de.bstly.we.invite.businesslogic.InviteMappingManager;
import de.bstly.we.invite.model.InviteMapping;
/**
* @author _bastler@bstly.de
*
* The Class InviteMappingController.
*/
@RestController
@RequestMapping("/invites/mappings")
@@ -40,10 +39,11 @@ public class InviteMappingController extends BaseController {
private InviteMappingManager inviteMappingManager;
/**
*
* @param pageParameter
* @param sizeParameter
* @return
* Gets the invite mappings.
*
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @return the invite mappings
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@GetMapping
@@ -55,9 +55,10 @@ public class InviteMappingController extends BaseController {
}
/**
*
* @param userModel
* @return
* Creates the or update.
*
* @param inviteMapping the invite mapping
* @return the invite mapping
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping
@@ -66,9 +67,10 @@ public class InviteMappingController extends BaseController {
}
/**
*
* @param inviteMappings
* @return
* Creates the or update list.
*
* @param inviteMappings the invite mappings
* @return the list
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping("/list")
@@ -86,8 +88,9 @@ public class InviteMappingController extends BaseController {
}
/**
*
* @param quota
* Delete.
*
* @param quota the quota
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping("/{quota}")
@@ -16,8 +16,7 @@ import javax.persistence.Table;
import de.bstly.we.model.UserData;
/**
* @author _bastler@bstly.de
*
* The Class Invite.
*/
@Entity
@Table(name = "invites")
@@ -39,6 +38,8 @@ public class Invite implements UserData {
private String codeLink;
/**
* Gets the id.
*
* @return the id
*/
public Long getId() {
@@ -46,13 +47,17 @@ public class Invite implements UserData {
}
/**
* @param id the id to set
* Sets the id.
*
* @param id the new id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Gets the owner.
*
* @return the owner
*/
public Long getOwner() {
@@ -60,13 +65,17 @@ public class Invite implements UserData {
}
/**
* @param owner the owner to set
* Sets the owner.
*
* @param owner the new owner
*/
public void setOwner(Long owner) {
this.owner = owner;
}
/**
* Gets the code.
*
* @return the code
*/
public String getCode() {
@@ -74,13 +83,17 @@ public class Invite implements UserData {
}
/**
* @param code the code to set
* Sets the code.
*
* @param code the new code
*/
public void setCode(String code) {
this.code = code;
}
/**
* Gets the item.
*
* @return the item
*/
public Integer getItem() {
@@ -88,13 +101,17 @@ public class Invite implements UserData {
}
/**
* @param item the item to set
* Sets the item.
*
* @param item the new item
*/
public void setItem(Integer item) {
this.item = item;
}
/**
* Gets the starts.
*
* @return the starts
*/
public Instant getStarts() {
@@ -102,13 +119,17 @@ public class Invite implements UserData {
}
/**
* @param starts the starts to set
* Sets the starts.
*
* @param starts the new starts
*/
public void setStarts(Instant starts) {
this.starts = starts;
}
/**
* Gets the expires.
*
* @return the expires
*/
public Instant getExpires() {
@@ -116,13 +137,17 @@ public class Invite implements UserData {
}
/**
* @param expires the expires to set
* Sets the expires.
*
* @param expires the new expires
*/
public void setExpires(Instant expires) {
this.expires = expires;
}
/**
* Gets the message.
*
* @return the message
*/
public String getMessage() {
@@ -130,13 +155,17 @@ public class Invite implements UserData {
}
/**
* @param message the message to set
* Sets the message.
*
* @param message the new message
*/
public void setMessage(String message) {
this.message = message;
}
/**
* Gets the note.
*
* @return the note
*/
public String getNote() {
@@ -144,35 +173,45 @@ public class Invite implements UserData {
}
/**
* @param note the note to set
* Sets the note.
*
* @param note the new note
*/
public void setNote(String note) {
this.note = note;
}
/**
* @return the redeemed
* Checks if is redeemed.
*
* @return true, if is redeemed
*/
public boolean isRedeemed() {
return redeemed;
}
/**
* @param redeemed the redeemed to set
* Sets the redeemed.
*
* @param redeemed the new redeemed
*/
public void setRedeemed(boolean redeemed) {
this.redeemed = redeemed;
}
/**
* @return the codeLink
* Gets the code link.
*
* @return the code link
*/
public String getCodeLink() {
return codeLink;
}
/**
* @param codeLink the codeLink to set
* Sets the code link.
*
* @param codeLink the new code link
*/
public void setCodeLink(String codeLink) {
this.codeLink = codeLink;
@@ -11,8 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author _bastler@bstly.de
*
* The Class InviteMapping.
*/
@Entity
@Table(name = "invite_mapping")
@@ -31,6 +30,8 @@ public class InviteMapping {
private String defaultMessage;
/**
* Gets the quota.
*
* @return the quota
*/
public String getQuota() {
@@ -38,13 +39,17 @@ public class InviteMapping {
}
/**
* @param quota the quota to set
* Sets the quota.
*
* @param quota the new quota
*/
public void setQuota(String quota) {
this.quota = quota;
}
/**
* Gets the item.
*
* @return the item
*/
public Integer getItem() {
@@ -52,13 +57,17 @@ public class InviteMapping {
}
/**
* @param item the item to set
* Sets the item.
*
* @param item the new item
*/
public void setItem(Integer item) {
this.item = item;
}
/**
* Gets the starts.
*
* @return the starts
*/
public Instant getStarts() {
@@ -66,13 +75,17 @@ public class InviteMapping {
}
/**
* @param starts the starts to set
* Sets the starts.
*
* @param starts the new starts
*/
public void setStarts(Instant starts) {
this.starts = starts;
}
/**
* Gets the expires.
*
* @return the expires
*/
public Instant getExpires() {
@@ -80,49 +93,63 @@ public class InviteMapping {
}
/**
* @param expires the expires to set
* Sets the expires.
*
* @param expires the new expires
*/
public void setExpires(Instant expires) {
this.expires = expires;
}
/**
* @return the messageLimit
* Gets the message limit.
*
* @return the message limit
*/
public Integer getMessageLimit() {
return messageLimit;
}
/**
* @param messageLimit the messageLimit to set
* Sets the message limit.
*
* @param messageLimit the new message limit
*/
public void setMessageLimit(Integer messageLimit) {
this.messageLimit = messageLimit;
}
/**
* @return the codeLink
* Gets the code link.
*
* @return the code link
*/
public String getCodeLink() {
return codeLink;
}
/**
* @param codeLink the codeLink to set
* Sets the code link.
*
* @param codeLink the new code link
*/
public void setCodeLink(String codeLink) {
this.codeLink = codeLink;
}
/**
* @return the defaultMessage
* Gets the default message.
*
* @return the default message
*/
public String getDefaultMessage() {
return defaultMessage;
}
/**
* @param defaultMessage the defaultMessage to set
* Sets the default message.
*
* @param defaultMessage the new default message
*/
public void setDefaultMessage(String defaultMessage) {
this.defaultMessage = defaultMessage;
@@ -10,9 +10,7 @@ import org.springframework.stereotype.Repository;
import de.bstly.we.invite.model.InviteMapping;
/**
*
* @author _bastler@bstly.de
*
* The Interface InviteMappingRepository.
*/
@Repository
public interface InviteMappingRepository
@@ -10,9 +10,7 @@ import org.springframework.stereotype.Repository;
import de.bstly.we.invite.model.Invite;
/**
*
* @author _bastler@bstly.de
*
* The Interface InviteRepository.
*/
@Repository
public interface InviteRepository