diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2023-10-14 23:19:46 +0200 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2023-10-14 23:19:46 +0200 |
commit | 73461bd79f923caa44740f170213a4abb4743660 (patch) | |
tree | 89cbb7403b4bf3f86a505d70a8f255b6463a2c3f /OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs | |
parent | Maybe fix libmatrix bug with room creation (diff) | |
download | OsuFederatedBeatmapApi-73461bd79f923caa44740f170213a4abb4743660.tar.xz |
Diffstat (limited to 'OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs')
-rw-r--r-- | OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs b/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs index 6a1149d..b1fa4f1 100644 --- a/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs +++ b/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs @@ -6,7 +6,7 @@ namespace OsuFederatedBeatmapApi.Controllers; [ApiController] [Route("/")] -public class BeatmapRepositoryController(ILogger<BeatmapRepositoryController> logger, FederatedBeatmapApiBotAccountDataService ads) : ControllerBase { +public class BeatmapRepositoryController(ILogger<BeatmapRepositoryController> logger, FederatedBeatmapApiBotAccountDataService ads, BeatmapFetcherService bfs) : ControllerBase { [HttpGet("/beatmapset/all/info")] public async IAsyncEnumerable<BeatmapSetInfo> GetAllInfo() { await ads.LoadAccountDataAsync(); @@ -24,8 +24,9 @@ public class BeatmapRepositoryController(ILogger<BeatmapRepositoryController> lo await ads.LoadAccountDataAsync(); foreach (var repo in ads.ListedRepositories) { - var states = await repo.GetStateAsync<BeatmapSetInfo>("gay.rory.beatmap_api.beatmap_set_info", id.ToString()); - return states as BeatmapSetInfo; + var state = await repo.GetStateOrNullAsync<BeatmapSetInfo>("gay.rory.beatmap_api.beatmap_set_info", id.ToString()); + if (state is not null) return state; + return await bfs.FetchBeatmapSetInfo(id); } return null; |