Docker compose con variabili d'ambiente

This commit is contained in:
Lorenzo Sanesi
2026-08-10 13:52:13 +02:00
parent f4afaf0792
commit 04ba3d541f
6 changed files with 147 additions and 50 deletions
+11
View File
@@ -13,6 +13,17 @@ class UsersService {
return await this.usersRepository.findById(id);
}
async getCurrentUserWithRank(id) {
const user = await this.usersRepository.findById(id);
const userJson = user.toJSON ? user.toJSON() : { ...user };
const totalUsers = await this.usersRepository.count();
const usersAbove = await this.usersRepository.countWithScoreAbove(userJson.score, id);
const rankPercentile = totalUsers > 1
? Math.max(1, Math.round((usersAbove / totalUsers) * 100))
: 1;
return { ...userJson, rankPercentile };
}
async searchUsers(query, excludeUserId) {
return await this.usersRepository.search(query, excludeUserId);
}