From 9f8eec792b9600cb2a39ef3f22f598ecb0d2cc84 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 27 Jun 2025 18:02:12 +0800 Subject: [PATCH] :bug: Fix missing pagination query in discovery controller --- .../Discovery/DiscoveryController.cs | 14 ++++++++------ DysonNetwork.Sphere/Discovery/DiscoveryService.cs | 8 +------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/DysonNetwork.Sphere/Discovery/DiscoveryController.cs b/DysonNetwork.Sphere/Discovery/DiscoveryController.cs index 2325331..5c9a7ea 100644 --- a/DysonNetwork.Sphere/Discovery/DiscoveryController.cs +++ b/DysonNetwork.Sphere/Discovery/DiscoveryController.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using DysonNetwork.Sphere.Realm; using Microsoft.AspNetCore.Mvc; namespace DysonNetwork.Sphere.Discovery; @@ -10,8 +7,13 @@ namespace DysonNetwork.Sphere.Discovery; public class DiscoveryController(DiscoveryService discoveryService) : ControllerBase { [HttpGet("realms")] - public Task> GetPublicRealms([FromQuery] string? query, [FromQuery] List? tags) + public Task> GetPublicRealms( + [FromQuery] string? query, + [FromQuery] List? tags, + [FromQuery] int take = 10, + [FromQuery] int offset = 0 + ) { - return discoveryService.GetPublicRealmsAsync(query, tags); + return discoveryService.GetPublicRealmsAsync(query, tags, take, offset); } -} \ No newline at end of file +} diff --git a/DysonNetwork.Sphere/Discovery/DiscoveryService.cs b/DysonNetwork.Sphere/Discovery/DiscoveryService.cs index bde1332..9b4c31c 100644 --- a/DysonNetwork.Sphere/Discovery/DiscoveryService.cs +++ b/DysonNetwork.Sphere/Discovery/DiscoveryService.cs @@ -1,10 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Realm; using Microsoft.EntityFrameworkCore; - namespace DysonNetwork.Sphere.Discovery; public class DiscoveryService(AppDatabase appDatabase) @@ -35,4 +29,4 @@ public class DiscoveryService(AppDatabase appDatabase) return realmsQuery.Skip(offset).Take(take).ToListAsync(); } -} \ No newline at end of file +}