WebApi + ClientApp, GraphQL, Reflection
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using Events.WebAPI.Contract.DTOs;
|
||||
using MediatR;
|
||||
|
||||
namespace Events.WebAPI.Contract.Queries.Generic;
|
||||
|
||||
public class DoesItemExistsQuery<TDto, TPK> (TPK id) : IRequest<bool>, IHasIdAsPK<TPK>
|
||||
where TPK : IEquatable<TPK>
|
||||
{
|
||||
public TPK Id { get; set; } = id;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using MediatR;
|
||||
|
||||
namespace Events.WebAPI.Contract.Queries.Generic;
|
||||
|
||||
public abstract class GetCountQuery : IRequest<int>
|
||||
{
|
||||
public string? Filters { get; set; }
|
||||
}
|
||||
|
||||
public class GetCountQuery<TDto> : GetCountQuery
|
||||
{
|
||||
public static GetCountQuery<TDto> CreateForPK<TPK>(TPK id) where TPK : IEquatable<TPK> {
|
||||
var query = new GetCountQuery<TDto>()
|
||||
{
|
||||
Filters = $"id=={id}"
|
||||
};
|
||||
return query;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MediatR;
|
||||
|
||||
namespace Events.WebAPI.Contract.Queries.Generic;
|
||||
|
||||
public class GetItemsQuery<TDto> : IRequest<List<TDto>>
|
||||
{
|
||||
public string? Filters { get; set; }
|
||||
public string? Sort { get; set; }
|
||||
public bool Ascending { get; set; }
|
||||
public int? PageSize { get; set; }
|
||||
public int? Page { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Events.WebAPI.Contract.DTOs;
|
||||
using MediatR;
|
||||
|
||||
namespace Events.WebAPI.Contract.Queries.Generic;
|
||||
|
||||
public class GetSingleItemQuery<TDto, TPK>(TPK id) : IRequest<TDto>, IHasIdAsPK<TPK>
|
||||
where TPK : IEquatable<TPK>
|
||||
{
|
||||
public TPK Id { get; set; } = id;
|
||||
}
|
||||
Reference in New Issue
Block a user