fel kesz game backend

This commit is contained in:
2025-09-15 19:00:35 +02:00
parent 7963f28021
commit 3af8de2797
267 changed files with 15655 additions and 347 deletions
@@ -49,10 +49,14 @@ export class GeneralSearchService implements IGeneralSearchService {
};
}
// Ensure limit is at least 1 to prevent database issues
const effectiveLimit = Math.max(limit || 20, 1);
const effectiveOffset = Math.max(offset || 0, 0);
try {
const { users, totalCount } = await this.userRepo.search(query.trim(), limit, offset);
const { users, totalCount } = await this.userRepo.search(query.trim(), effectiveLimit, effectiveOffset);
const results = users.map(user => UserMapper.toShortDto(user));
const hasMore = (offset + limit) < totalCount;
const hasMore = (effectiveOffset + effectiveLimit) < totalCount;
return {
results,
@@ -105,17 +109,25 @@ export class GeneralSearchService implements IGeneralSearchService {
};
}
const { decks, totalCount } = await this.deckRepo.search(query.trim(), limit, offset);
const results = decks.map(deck => DeckMapper.toShortDto(deck));
const hasMore = (offset + limit) < totalCount;
// Ensure limit is at least 1 to prevent database issues
const effectiveLimit = Math.max(limit || 20, 1);
const effectiveOffset = Math.max(offset || 0, 0);
return {
results,
totalCount,
hasMore,
searchQuery: query,
searchType: 'decks'
};
try {
const { decks, totalCount } = await this.deckRepo.search(query.trim(), effectiveLimit, effectiveOffset);
const results = decks.map(deck => DeckMapper.toShortDto(deck));
const hasMore = (effectiveOffset + effectiveLimit) < totalCount;
return {
results,
totalCount,
hasMore,
searchQuery: query,
searchType: 'decks'
};
} catch (error) {
throw new Error('Failed to search decks');
}
}
async searchByType(