mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-16 05:43:23 +00:00
Fix storage.getServicesByName() calls - use correct storage methods
Replace non-existent getServicesByName() with: - discoverServices() for paginated mode - getRandomService() for random mode Fixes "storage.getServicesByName is not a function" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -215,7 +215,7 @@ const handlers: Record<string, RpcHandler> = {
|
|||||||
const pageLimit = Math.min(Math.max(1, limit), MAX_PAGE_SIZE);
|
const pageLimit = Math.min(Math.max(1, limit), MAX_PAGE_SIZE);
|
||||||
const pageOffset = Math.max(0, offset || 0);
|
const pageOffset = Math.max(0, offset || 0);
|
||||||
|
|
||||||
const allServices = await storage.getServicesByName(parsed.service, parsed.version);
|
const allServices = await storage.discoverServices(parsed.service, parsed.version, 1000, 0);
|
||||||
const compatibleServices = filterCompatibleServices(allServices);
|
const compatibleServices = filterCompatibleServices(allServices);
|
||||||
|
|
||||||
// Get unique services per username with available offers
|
// Get unique services per username with available offers
|
||||||
@@ -260,14 +260,12 @@ const handlers: Record<string, RpcHandler> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mode 3: Random discovery without username
|
// Mode 3: Random discovery without username
|
||||||
const allServices = await storage.getServicesByName(parsed.service, parsed.version);
|
const randomService = await storage.getRandomService(parsed.service, parsed.version);
|
||||||
const compatibleServices = filterCompatibleServices(allServices);
|
|
||||||
|
|
||||||
if (compatibleServices.length === 0) {
|
if (!randomService) {
|
||||||
throw new Error('No services found');
|
throw new Error('No services found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const randomService = compatibleServices[Math.floor(Math.random() * compatibleServices.length)];
|
|
||||||
const availableOffer = await findAvailableOffer(randomService);
|
const availableOffer = await findAvailableOffer(randomService);
|
||||||
|
|
||||||
if (!availableOffer) {
|
if (!availableOffer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user