refactor(search): remove dead SENDER case from resolveSort switch

SENDER and RECEIVER are handled by in-memory sort before resolveSort
is called, making those switch cases unreachable. Removed and added
a comment making the invariant explicit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-06 16:31:39 +02:00
parent 12023513b2
commit 6ac3f6b176

View File

@@ -308,9 +308,9 @@ public class DocumentService {
if (sort == null || sort == DocumentSort.DATE) {
return Sort.by(direction, "documentDate");
}
// SENDER and RECEIVER are sorted in-memory before this method is called
return switch (sort) {
case TITLE -> Sort.by(direction, "title");
case SENDER -> Sort.by(direction, "sender.lastName").and(Sort.by(direction, "sender.firstName"));
case UPLOAD_DATE -> Sort.by(direction, "createdAt");
default -> Sort.by(direction, "documentDate");
};