(frature): base object for query result
This commit is contained in:
parent
01ad1ddb8e
commit
1a188e4688
5
src/MaksIT.Core/Abstractions/Query/QueryResultBase.cs
Normal file
5
src/MaksIT.Core/Abstractions/Query/QueryResultBase.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MaksIT.Core.Abstractions.Query;
|
||||||
|
|
||||||
|
public abstract class QueryResultBase<T> {
|
||||||
|
public required T Id { get; set; }
|
||||||
|
}
|
||||||
@ -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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user