Return proper responses for missing seed ids

This commit is contained in:
2025-03-03 07:50:06 -06:00
parent a2dc4372bb
commit 8aa2fae591
5 changed files with 34 additions and 16 deletions

View File

@@ -1,21 +1,26 @@
namespace ALttPRandomizer.Service {
using ALttPRandomizer.Azure;
using ALttPRandomizer.Model;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
public class SeedService {
public SeedService(AzureStorage azureStorage) {
public SeedService(AzureStorage azureStorage, ILogger<SeedService> logger) {
this.AzureStorage = azureStorage;
this.Logger = logger;
}
private AzureStorage AzureStorage { get; }
private ILogger<SeedService> Logger { get; }
public async Task<IDictionary<string, object>> GetSeed(string seedId) {
var files = await this.AzureStorage.GetFiles(seedId);
this.Logger.LogDebug("Found files: {@files}", files.Keys);
var result = new Dictionary<string, object>();
if (!files.TryGetValue("settings.json", out var settingsData)) {