feat: Implement Query endpoint for Connections puzzles

This commit is contained in:
2024-12-27 09:45:53 +01:00
parent 82733693f1
commit 70ee4e076e
7 changed files with 66 additions and 118 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.IO.Compression;
using ConnectionsAPI.Models.Request;
using FluentValidation;
@@ -15,5 +16,13 @@ public class QueryPuzzlesRequestValidator : Validator<QueryPuzzlesRequest>
RuleFor(x => x.Count)
.Must(x => x > 0)
.WithMessage(x => "Item count must be a positive integer");
RuleFor(x => x.Year)
.Must(x => x == null || (x != null && x >= 2021 && x <= DateTime.UtcNow.Year + 1))
.WithMessage($"Year must be a valid year between 2021 and {DateTime.UtcNow.Year + 1}");
RuleFor(x => x.Month)
.Must(x => x == null || (x != null && x >= 1 && x <= 12))
.WithMessage("Month must be a valid month");
}
}