-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Syriiin/clean-up-api
Clean up API
- Loading branch information
Showing
27 changed files
with
476 additions
and
1,556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using Difficalcy.Models; | ||
|
||
namespace Difficalcy.Catch.Models | ||
{ | ||
public record CatchScore : Score | ||
public record CatchScore : Score, IValidatableObject | ||
{ | ||
public double? Accuracy { get; init; } | ||
[Range(0, int.MaxValue)] | ||
public int? Combo { get; init; } | ||
public int? Misses { get; init; } | ||
public int? TinyDroplets { get; init; } | ||
public int? Droplets { get; init; } | ||
|
||
/// <summary> | ||
/// The number of fruit and large droplet misses. | ||
/// </summary> | ||
[Range(0, int.MaxValue)] | ||
public int Misses { get; init; } = 0; // fruit + large droplet misses | ||
|
||
[Range(0, int.MaxValue)] | ||
public int? SmallDroplets { get; init; } | ||
|
||
[Range(0, int.MaxValue)] | ||
public int? LargeDroplets { get; init; } | ||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
if (Misses > 0 && Combo is null) | ||
{ | ||
yield return new ValidationResult("Combo must be specified if Misses are greater than 0.", [nameof(Combo)]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using Difficalcy.Models; | ||
|
||
namespace Difficalcy.Mania.Models | ||
{ | ||
public record ManiaScore : Score | ||
{ | ||
public double? Accuracy { get; init; } | ||
public int? Misses { get; init; } | ||
public int? Mehs { get; init; } | ||
public int? Oks { get; init; } | ||
public int? Goods { get; init; } | ||
public int? Greats { get; init; } | ||
[Range(0, int.MaxValue)] | ||
public int Misses { get; init; } = 0; | ||
|
||
[Range(0, int.MaxValue)] | ||
public int Mehs { get; init; } = 0; | ||
|
||
[Range(0, int.MaxValue)] | ||
public int Oks { get; init; } = 0; | ||
|
||
[Range(0, int.MaxValue)] | ||
public int Goods { get; init; } = 0; | ||
|
||
[Range(0, int.MaxValue)] | ||
public int Greats { get; init; } = 0; | ||
} | ||
} |
Oops, something went wrong.