Implement score table functionality with ScoreTable, ScoreEntry, and ScoreTableService; add Timeframe and ScoreType enums; enhance User and StatsList models for better stats management
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good

This commit is contained in:
2026-01-08 02:51:29 +01:00
parent 266d9ff3bb
commit caff26d7ca
15 changed files with 599 additions and 10 deletions
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
@Transactional
@@ -270,4 +271,45 @@ public class FriendshipService {
return dtoList;
}
public record NameWithFriendship(
Long id,
String name,
boolean friendship
) {}
public List<NameWithFriendship> getPrivateNameIfFriendshipAccepted(User user, List<Long> otherUserIds) {
List<NameWithFriendship> result = new ArrayList<>();
for (Long otherUserId : otherUserIds) {
Friendship friendship =
friendshipRepository.findByUserIdAndFriendIdAndStatus(
user.getId(),
otherUserId,
FriendShipStatus.ACCEPTED
);
if (friendship != null) {
User target = friendship.getFriend();
result.add(new NameWithFriendship(
target.getId(),
target.getPrivateName(),
true
));
} else {
User target = userRepository.findById(otherUserId)
.orElseThrow(() -> new RuntimeException("User not found"));
result.add(new NameWithFriendship(
target.getId(),
target.getPublicName(),
false
));
}
}
return result;
}
}