refactor naming + user

This commit is contained in:
_Bastler 2021-10-04 16:57:20 +02:00
parent 29cd81b093
commit 59321f4a3d
13 changed files with 218 additions and 125 deletions

View File

@ -43,7 +43,7 @@ public class BookmarksManager {
* Checks for entry.
*
* @param username the username
* @param entryId the entry id
* @param entryId the entry id
* @return true, if successful
*/
public boolean hasEntry(String username, Long entryId) {
@ -55,7 +55,7 @@ public class BookmarksManager {
* Adds the entry.
*
* @param username the username
* @param entryId the entry id
* @param entryId the entry id
*/
public void addEntry(String username, Long entryId) {
Assert.isTrue(entryRepository.existsById(entryId), "Invalid entryid");
@ -76,7 +76,7 @@ public class BookmarksManager {
* Removes the entry.
*
* @param username the username
* @param entryId the entry id
* @param entryId the entry id
*/
public void removeEntry(String username, Long entryId) {
Assert.isTrue(entryRepository.existsById(entryId), "Invalid entryid");

View File

@ -43,12 +43,12 @@ public class CommentManager {
/**
* Fetch by ranking.
*
* @param target the target
* @param parent the parent
* @param date the date
* @param target the target
* @param parent the parent
* @param date the date
* @param gravity the gravity
* @param page the page
* @param size the size
* @param page the page
* @param size the size
* @return the page
*/
@ -68,23 +68,43 @@ public class CommentManager {
*
* @param target the target
* @param parent the parent
* @param date the date
* @param page the page
* @param size the size
* @param date the date
* @param page the page
* @param size the size
* @param desc the desc
* @return the page
*/
public Page<Comment> fetchByDate(Long target, Long parent, Instant date, int page, int size) {
public Page<Comment> fetchByDate(Long target, Long parent, Instant date, int page, int size,
boolean desc) {
Sort sort = Sort.by(desc ? Order.desc("created") : Order.asc("created"));
if (parent == null) {
return commentRepository.findAll(
qComment.target.eq(target).and(qComment.parent.isNull())
.and(qComment.created.before(date)),
PageRequest.of(page, size, Sort.by(Order.asc("created"))));
return commentRepository
.findAll(
qComment.target.eq(target).and(qComment.parent.isNull())
.and(qComment.created.before(date)),
PageRequest.of(page, size, sort));
}
return commentRepository.findAll(
qComment.target.eq(target).and(qComment.parent.eq(parent))
.and(qComment.created.before(date)),
PageRequest.of(page, size, Sort.by(Order.asc("created"))));
return commentRepository.findAll(qComment.target.eq(target).and(qComment.parent.eq(parent))
.and(qComment.created.before(date)), PageRequest.of(page, size, sort));
}
/**
* Fetch by username.
*
* @param username the username
* @param orElse the or else
* @param date the date
* @param page the page
* @param size the size
* @param asc the asc
* @return the page
*/
public Page<Comment> fetchByUsername(String username, Long orElse, Instant date, int page,
int size, boolean asc) {
Sort sort = Sort.by(asc ? Order.asc("created") : Order.desc("created"));
return commentRepository.findAll(qComment.author.eq(username).and(qComment.parent.isNull())
.and(qComment.created.before(date)), PageRequest.of(page, size, sort));
}
/**
@ -116,7 +136,7 @@ public class CommentManager {
* Apply metadata.
*
* @param username the username
* @param comment the comment
* @param comment the comment
*/
public void applyMetadata(String username, Comment comment) {
if (!comment.getMetadata().containsKey("comments")) {
@ -153,7 +173,7 @@ public class CommentManager {
* Apply metadata.
*
* @param username the username
* @param entries the entries
* @param entries the entries
*/
public void applyMetadata(String username, List<Comment> entries) {
for (Comment comment : entries) {

View File

@ -50,19 +50,16 @@ public class EntryManager {
@Value("${bstly.board.ranking.gravity:1.8}")
private double GRAVITY;
/**
* Direct fetch by ranking.
* Fetch by ranking.
*
* @param date the date
* @param date the date
* @param gravity the gravity
* @param page the page
* @param size the size
* @param page the page
* @param size the size
* @return the page
*/
public Page<RankedEntry> fetchByRanking(Instant date, double gravity, int page,
int size) {
public Page<RankedEntry> fetchByRanking(Instant date, double gravity, int page, int size) {
return entryRepository.findAllByRanking(date, gravity, PageRequest.of(page, size));
}
@ -80,12 +77,28 @@ public class EntryManager {
}
/**
* Gets the entries.
* Fetch by user.
*
* @param username the username
* @param page the page
* @param size the size
* @return the entries
* @param date the date
* @param page the page
* @param size the size
* @param asc the asc
* @return the page
*/
public Page<Entry> fetchByUser(String username, Instant date, int page, int size, boolean asc) {
Sort sort = Sort.by(asc ? Order.asc("created") : Order.desc("created"));
return entryRepository.findAll(qEntry.author.eq(username).and(qEntry.created.before(date)),
PageRequest.of(page, size, sort));
}
/**
* Fetch by bookmarks.
*
* @param username the username
* @param page the page
* @param size the size
* @return the page
*/
public Page<Entry> fetchByBookmarks(String username, int page, int size) {
Bookmarks bookmarks = bookmarksManager.get(username);
@ -102,7 +115,7 @@ public class EntryManager {
* Apply metadata.
*
* @param username the username
* @param entry the entry
* @param entry the entry
*/
public void applyMetadata(String username, Entry entry) {
if (!entry.getMetadata().containsKey("comments")) {
@ -142,7 +155,7 @@ public class EntryManager {
* Apply metadata.
*
* @param username the username
* @param entries the entries
* @param entries the entries
*/
public void applyMetadata(String username, List<Entry> entries) {
for (Entry entry : entries) {

View File

@ -20,7 +20,7 @@ public class InstantHelper {
* Plus.
*
* @param instant the instant
* @param amount the amount
* @param amount the amount
* @return the instant
*/
public static Instant plus(Instant instant, TemporalAmount amount) {
@ -30,9 +30,9 @@ public class InstantHelper {
/**
* Plus.
*
* @param instant the instant
* @param instant the instant
* @param amountToAdd the amount to add
* @param unit the unit
* @param unit the unit
* @return the instant
*/
public static Instant plus(Instant instant, long amountToAdd, TemporalUnit unit) {
@ -43,7 +43,7 @@ public class InstantHelper {
* Minus.
*
* @param instant the instant
* @param amount the amount
* @param amount the amount
* @return the instant
*/
public static Instant minus(Instant instant, TemporalAmount amount) {
@ -53,9 +53,9 @@ public class InstantHelper {
/**
* Minus.
*
* @param instant the instant
* @param instant the instant
* @param amountToAdd the amount to add
* @param unit the unit
* @param unit the unit
* @return the instant
*/
public static Instant minus(Instant instant, long amountToAdd, TemporalUnit unit) {
@ -67,7 +67,7 @@ public class InstantHelper {
* Truncate.
*
* @param instant the instant
* @param unit the unit
* @param unit the unit
* @return the instant
*/
public static Instant truncate(Instant instant, TemporalUnit unit) {

View File

@ -64,6 +64,12 @@ public class UserManager implements UserDetailsService, SmartInitializingSinglet
* @see org.springframework.security.core.userdetails.UserDetailsService#
* loadUserByUsername(java.lang.String)
*/
/*
* @see org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
*/
/*
* @see org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
*/
/*
* @see
* de.bstly.board.businesslogic.LocalUserManager#loadUserByUsername(java.lang.
@ -91,6 +97,12 @@ public class UserManager implements UserDetailsService, SmartInitializingSinglet
* @see org.springframework.beans.factory.SmartInitializingSingleton#
* afterSingletonsInstantiated()
*/
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
*/
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
*/
/*
*
* @see org.springframework.beans.factory.SmartInitializingSingleton#
@ -199,7 +211,7 @@ public class UserManager implements UserDetailsService, SmartInitializingSinglet
* Apply metadata.
*
* @param username the username
* @param user the user
* @param user the user
*/
public void applyMetadata(String username, LocalUser user) {
if (user.getUsername().equals(username) && !user.getMetadata().containsKey("self")) {

View File

@ -26,9 +26,9 @@ public class VoteManager {
/**
* Gets the.
*
* @param author the author
* @param author the author
* @param targetType the target type
* @param target the target
* @param target the target
* @return the vote
*/
public Vote get(String author, Types targetType, Long target) {
@ -58,7 +58,7 @@ public class VoteManager {
/**
* Delete by target.
*
* @param target the target
* @param target the target
* @param targetType the target type
*/
public void deleteByTarget(Long target, Types targetType) {
@ -71,7 +71,7 @@ public class VoteManager {
/**
* Gets the points.
*
* @param target the target
* @param target the target
* @param targetType the target type
* @return the points
*/

View File

@ -27,7 +27,7 @@ import de.bstly.board.model.Entry;
* The Class BookmarksController.
*/
@RestController
@RequestMapping("/b")
@RequestMapping("/bookmarks")
public class BookmarksController extends BaseController {
@Autowired

View File

@ -29,36 +29,30 @@ import de.bstly.board.model.Types;
import de.bstly.board.model.Vote;
import de.bstly.board.model.VoteType;
/**
* The Class CommentController.
*/
@RestController
@RequestMapping("/c")
@RequestMapping("/comments")
public class CommentController extends BaseController {
@Autowired
private CommentManager commentManager;
@Autowired
private CommentValidator commentValidator;
@Autowired
private VoteManager voteManager;
@Value("${bstly.board.size:30}")
private int SIZE;
@Value("${bstly.board.ranking.gravity:1.8}")
private double GRAVITY;
/**
* Ranked comments.
* Fetch by rank.
*
* @param target the target
* @param parent the parent
@ -69,23 +63,70 @@ public class CommentController extends BaseController {
* @return the page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping({ "/e/{target}", "/e/{target}/{parent}" })
public Page<Comment> rankedComments(@PathVariable("target") Long target,
@GetMapping({ "/{target}", "/{target}/{parent}" })
public Page<Comment> fetchByRank(@PathVariable("target") Long target,
@PathVariable("parent") Optional<Long> parent,
@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter,
@RequestParam("gravity") Optional<Double> gravityParameter) {
Page<Comment> comments = newComments(target, parent, pageParameter, sizeParameter,
dateParameter);
Page<Comment> comments = fetchByDate(target, parent, pageParameter, sizeParameter,
dateParameter, Optional.of(false));
commentManager.applyMetadata(getCurrentUsername(), comments.getContent());
return comments;
}
// Page<Comment> comments = commentManager.fetchByRanking(target, parent.orElse(null),
// dateParameter.orElse(Instant.now()), gravityParameter.orElse(GRAVITY),
// pageParameter.orElse(0), sizeParameter.orElse(SIZE));
// return comments;
/**
* Fetch by date.
*
* @param target the target
* @param parent the parent
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param dateParameter the date parameter
* @param descParameter the desc parameter
* @return the page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping({ "/new/{target}", "/new/{target}/{parent}" })
public Page<Comment> fetchByDate(@PathVariable("target") Long target,
@PathVariable("parent") Optional<Long> parent,
@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter,
@RequestParam("desc") Optional<Boolean> descParameter) {
Page<Comment> comments = commentManager.fetchByDate(target, parent.orElse(null),
dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
sizeParameter.orElse(SIZE), descParameter.orElse(false));
commentManager.applyMetadata(getCurrentUsername(), comments.getContent());
return comments;
}
/**
* Fetch by username.
*
* @param username the username
* @param parent the parent
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param dateParameter the date parameter
* @param ascParameter the asc parameter
* @return the page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping({ "/byuser/{username}" })
public Page<Comment> fetchByUsername(@PathVariable("username") String username,
@PathVariable("parent") Optional<Long> parent,
@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter,
@RequestParam("asc") Optional<Boolean> ascParameter) {
Page<Comment> comments = commentManager.fetchByUsername(username, parent.orElse(null),
dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
sizeParameter.orElse(SIZE), ascParameter.orElse(false));
commentManager.applyMetadata(getCurrentUsername(), comments.getContent());
return comments;
}
/**
@ -96,36 +137,12 @@ public class CommentController extends BaseController {
* @return the long
*/
@PreAuthorize("isAuthenticated()")
@GetMapping({ "/c/{target}", "/c/{target}/{parent}" })
@GetMapping({ "/count/{target}", "/count/{target}/{parent}" })
public Long countComments(@PathVariable("target") Long target,
@PathVariable("parent") Optional<Long> parent) {
return commentManager.count(target, parent.orElse(null));
}
/**
* New comments.
*
* @param target the target
* @param parent the parent
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param dateParameter the date parameter
* @return the page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping({ "/e/new/{target}", "/e/new/{target}/{parent}" })
public Page<Comment> newComments(@PathVariable("target") Long target,
@PathVariable("parent") Optional<Long> parent,
@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter) {
Page<Comment> comments = commentManager.fetchByDate(target, parent.orElse(null),
dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
sizeParameter.orElse(SIZE));
commentManager.applyMetadata(getCurrentUsername(), comments.getContent());
return comments;
}
/**
* Gets the comment.
*
@ -133,7 +150,7 @@ public class CommentController extends BaseController {
* @return the comment
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/{id}")
@GetMapping("/comment/{id}")
public Comment getComment(@PathVariable("id") Long id) {
Comment comment = commentManager.get(id);
@ -153,7 +170,7 @@ public class CommentController extends BaseController {
* @return the comment
*/
@PreAuthorize("isAuthenticated()")
@PostMapping()
@PostMapping
public Comment createComment(@RequestBody Comment comment) {
RequestBodyErrors bindingResult = new RequestBodyErrors(comment);
commentValidator.validate(comment, bindingResult);
@ -175,7 +192,7 @@ public class CommentController extends BaseController {
voteManager.save(vote);
commentManager.applyMetadata(getCurrentUsername(), comment);
return comment;
}

View File

@ -37,7 +37,7 @@ import de.bstly.board.model.VoteType;
* The Class EntryController.
*/
@RestController
@RequestMapping("/e")
@RequestMapping("/entries")
public class EntryController extends BaseController {
@Autowired
@ -56,17 +56,17 @@ public class EntryController extends BaseController {
private double GRAVITY;
/**
* Ranked entries.
* Fetch by ranking.
*
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param dateParameter the date parameter
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param dateParameter the date parameter
* @param gravityParameter the gravity parameter
* @return the page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping()
public Page<Entry> rankedEntries(@RequestParam("page") Optional<Integer> pageParameter,
public Page<Entry> fetchByRanking(@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter,
@RequestParam("gravity") Optional<Double> gravityParameter) {
@ -89,7 +89,7 @@ public class EntryController extends BaseController {
}
/**
* New entries.
* Fetch by date.
*
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
@ -98,7 +98,7 @@ public class EntryController extends BaseController {
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/new")
public Page<Entry> newEntries(@RequestParam("page") Optional<Integer> pageParameter,
public Page<Entry> fetchByDate(@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter) {
@ -112,6 +112,35 @@ public class EntryController extends BaseController {
return entries;
}
/**
* Fetch by user.
*
* @param username the username
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param dateParameter the date parameter
* @param ascParameter the asc parameter
* @return the page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/byuser/{username}")
public Page<Entry> fetchByUser(@PathVariable("username") String username,
@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("date") Optional<Instant> dateParameter,
@RequestParam("asc") Optional<Boolean> ascParameter) {
if (sizeParameter.isPresent() && sizeParameter.get() > 100) {
sizeParameter = Optional.of(100);
}
Page<Entry> entries = entryManager.fetchByUser(username,
dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
sizeParameter.orElse(SIZE), ascParameter.orElse(false));
entryManager.applyMetadata(getCurrentUsername(), entries.getContent());
return entries;
}
/**
* Gets the entry.
*
@ -119,7 +148,7 @@ public class EntryController extends BaseController {
* @return the entry
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/{id}")
@GetMapping("/entry/{id}")
public Entry getEntry(@PathVariable("id") Long id) {
Entry entry = entryManager.get(id);
@ -162,7 +191,7 @@ public class EntryController extends BaseController {
voteManager.save(vote);
entryManager.applyMetadata(getCurrentUsername(), entry);
return entry;
}

View File

@ -25,7 +25,7 @@ import de.bstly.board.model.LocalUser;
* The Class ModerationController.
*/
@RestController
@RequestMapping("/m")
@RequestMapping("/moderation")
public class ModerationController {
@ -46,7 +46,7 @@ public class ModerationController {
* @param id the id
*/
@PreAuthorize("hasRole('ROLE_ADMIN') || hasRole('ROLE_MOD')")
@DeleteMapping("/c/{id}")
@DeleteMapping("/comment/{id}")
public void deleteComment(@PathVariable("id") Long id) {
if (!commentManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -61,7 +61,7 @@ public class ModerationController {
* @param id the id
*/
@PreAuthorize("hasRole('ROLE_ADMIN') || hasRole('ROLE_MOD')")
@DeleteMapping("/e/{id}")
@DeleteMapping("/entry/{id}")
public void deleteEntry(@PathVariable("id") Long id) {
if (!entryManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -76,7 +76,7 @@ public class ModerationController {
* @param username the username
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PutMapping("/u/{username}")
@PutMapping("/user/{username}")
public void makeMod(@PathVariable("username") String username) {
LocalUser user = userManager.getByUsername(username);
@ -103,7 +103,7 @@ public class ModerationController {
* @param username the username
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping("/u/{username}")
@DeleteMapping("/user/{username}")
public void unmakeMode(@PathVariable("username") String username) {
LocalUser user = userManager.getByUsername(username);

View File

@ -24,7 +24,7 @@ import de.bstly.board.model.LocalUser;
* The Class UserController.
*/
@RestController
@RequestMapping("/u")
@RequestMapping("/users")
public class UserController extends BaseController {
@ -38,7 +38,7 @@ public class UserController extends BaseController {
* @return the user
*/
@PreAuthorize("isAuthenticated()")
@GetMapping({ "", "/{username}" })
@GetMapping({ "/user", "/user/{username}" })
public LocalUser getUser(@PathVariable("username") Optional<String> usernameParameter) {
String username = usernameParameter.orElse(getCurrentUsername());
@ -68,7 +68,7 @@ public class UserController extends BaseController {
* @return the local user
*/
@PreAuthorize("isAuthenticated()")
@PostMapping()
@PostMapping("/user")
public LocalUser updateUser(@RequestBody LocalUser user) {
if (!getCurrentUsername().equals(user.getUsername())) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);

View File

@ -26,7 +26,7 @@ import de.bstly.board.model.VoteType;
* The Class VoteController.
*/
@RestController
@RequestMapping("/v")
@RequestMapping("/votes")
public class VoteController extends BaseController {
@ -48,7 +48,7 @@ public class VoteController extends BaseController {
* @return the entry points
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/e/{id}")
@GetMapping("/entry/{id}")
public long getEntryPoints(@PathVariable("id") Long id) {
if (!entryManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -63,7 +63,7 @@ public class VoteController extends BaseController {
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@PutMapping("/e/{id}/up")
@PutMapping("/entry/{id}/up")
public void voteEntryUp(@PathVariable("id") Long id) {
if (!entryManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -89,7 +89,7 @@ public class VoteController extends BaseController {
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@PutMapping("/e/{id}/down")
@PutMapping("/entry/{id}/down")
public void voteEntryDown(@PathVariable("id") Long id) {
if (!entryManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -115,7 +115,7 @@ public class VoteController extends BaseController {
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@DeleteMapping("/e/{id}")
@DeleteMapping("/entry/{id}")
public void unvoteEntry(@PathVariable("id") Long id) {
if (!entryManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -136,7 +136,7 @@ public class VoteController extends BaseController {
* @return the comment points
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/c/{id}")
@GetMapping("/comment/{id}")
public long getCommentPoints(@PathVariable("id") Long id) {
if (!commentManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -151,7 +151,7 @@ public class VoteController extends BaseController {
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@PutMapping("/c/{id}/up")
@PutMapping("/comment/{id}/up")
public void voteCommentUp(@PathVariable("id") Long id) {
if (!commentManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -177,7 +177,7 @@ public class VoteController extends BaseController {
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@PutMapping("/c/{id}/down")
@PutMapping("/comment/{id}/down")
public void voteCommentDown(@PathVariable("id") Long id) {
if (!commentManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
@ -203,7 +203,7 @@ public class VoteController extends BaseController {
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@DeleteMapping("/c/{id}")
@DeleteMapping("/comment/{id}")
public void unvoteComment(@PathVariable("id") Long id) {
if (!commentManager.exists(id)) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);

View File

@ -36,14 +36,16 @@ public class Bookmarks {
private List<Long> entries;
/**
* @param username
* Instantiates a new bookmarks.
*/
public Bookmarks() {
super();
}
/**
* @param username
* Instantiates a new bookmarks.
*
* @param username the username
*/
public Bookmarks(String username) {
super();