mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-04 04:54:40 +00:00
Return 404 when user or post not found
This commit is contained in:
@@ -17,7 +17,7 @@ public class UserVisitService {
|
||||
|
||||
public void recordVisit(String username) {
|
||||
User user = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new IllegalArgumentException("User not found"));
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("User not found"));
|
||||
LocalDate today = LocalDate.now();
|
||||
userVisitRepository.findByUserAndVisitDate(user, today).orElseGet(() -> {
|
||||
UserVisit visit = new UserVisit();
|
||||
@@ -29,7 +29,7 @@ public class UserVisitService {
|
||||
|
||||
public long countVisits(String username) {
|
||||
User user = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new IllegalArgumentException("User not found"));
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("User not found"));
|
||||
return userVisitRepository.countByUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user