Add pseudoboots and model validation
This commit is contained in:
@@ -87,6 +87,9 @@
|
|||||||
[RequiredSetting([Apr2025], PrizeShuffle.Vanilla)]
|
[RequiredSetting([Apr2025], PrizeShuffle.Vanilla)]
|
||||||
[NoSettingName([Apr2025])]
|
[NoSettingName([Apr2025])]
|
||||||
public PrizeShuffle PrizeShuffle { get; set; } = PrizeShuffle.Vanilla;
|
public PrizeShuffle PrizeShuffle { get; set; } = PrizeShuffle.Vanilla;
|
||||||
|
|
||||||
|
[NoSettingName]
|
||||||
|
public BootsSettings StartingBoots { get; set; } = BootsSettings.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RandomizerInstance {
|
public enum RandomizerInstance {
|
||||||
@@ -211,4 +214,9 @@
|
|||||||
Nearby,
|
Nearby,
|
||||||
Wild,
|
Wild,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum BootsSettings {
|
||||||
|
None,
|
||||||
|
[AdditionalSetting("--pseudoboots")] Pseudoboots,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,8 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddControllers().AddJsonOptions(x => {
|
builder.Services.AddControllers()
|
||||||
|
.AddJsonOptions(x => {
|
||||||
x.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
x.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
||||||
x.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
|
x.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
|
||||||
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseLower, false));
|
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseLower, false));
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
[Route("/generate")]
|
[Route("/generate")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult> Generate([FromBody] SeedSettings settings) {
|
public async Task<ActionResult> Generate([FromBody] SeedSettings settings) {
|
||||||
|
if (!ModelState.IsValid) {
|
||||||
|
return BadRequest(ModelState);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
var id = await this.RandomizeService.RandomizeSeed(settings);
|
var id = await this.RandomizeService.RandomizeSeed(settings);
|
||||||
var url = string.Format("/seed/{0}", id);
|
var url = string.Format("/seed/{0}", id);
|
||||||
|
|||||||
Reference in New Issue
Block a user