(frature): base object for query result

This commit is contained in:
Maksym Sadovnychyy 2025-01-12 23:05:25 +01:00
parent 01ad1ddb8e
commit 1a188e4688
3 changed files with 8 additions and 3 deletions

View File

@ -0,0 +1,5 @@
namespace MaksIT.Core.Abstractions.Query;
public abstract class QueryResultBase<T> {
public required T Id { get; set; }
}

View File

@ -41,13 +41,13 @@ public abstract class PatchRequestModelBase : RequestModelBase {
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) {
if (!HasNonNullPatchField) { if (!HasNonNullPatchField) {
yield return new ValidationResult("At least one patch field must be provided", new string[] { "PatchField" }); yield return new ValidationResult("At least one patch field must be provided", ["PatchField"]);
} }
if (Operations != null) { if (Operations != null) {
foreach (var operation in Operations) { foreach (var operation in Operations) {
if (!Enum.IsDefined(typeof(PatchOperation), operation.Value)) { if (!Enum.IsDefined(typeof(PatchOperation), operation.Value)) {
yield return new ValidationResult($"Invalid patch operation '{operation.Value}' for property '{operation.Key}'", new string[] { operation.Key }); yield return new ValidationResult($"Invalid patch operation '{operation.Value}' for property '{operation.Key}'", [operation.Key]);
} }
} }
} }

View File

@ -8,7 +8,7 @@
<!-- NuGet package metadata --> <!-- NuGet package metadata -->
<PackageId>MaksIT.Core</PackageId> <PackageId>MaksIT.Core</PackageId>
<Version>1.3.5</Version> <Version>1.3.6</Version>
<Authors>Maksym Sadovnychyy</Authors> <Authors>Maksym Sadovnychyy</Authors>
<Company>MAKS-IT</Company> <Company>MAKS-IT</Company>
<Product>MaksIT.Core</Product> <Product>MaksIT.Core</Product>