using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore.Query; using xModels.Base; using xModels.Dtos; using xPushService.Base; namespace xPushService.Interfaces { public interface IXBaseServiceProviderController where TEntity : XBaseEntity where TDto : XBaseEntityDto where THub : XBaseDtoHub { // #region Properties ... IXBaseDtoProvider Provider { get; } Func, IOrderedQueryable> DefaultOrderBuilder { get; } Func, IIncludableQueryable> DefaultIncludeBuilder { get; } #endregion // #region Actions ... /// /// add a new Item ... /// /// /// /// /// [HttpPost] Task> Add( [FromBody] TDto item, [FromQuery] bool saveChanges = true, CancellationToken cancellationToken = default ); /// /// Update an Item values ... /// /// /// /// /// /// [HttpPut("{id}")] Task> Update( [FromRoute] TKey id, [FromBody] TDto item, [FromQuery] bool saveChanges = true, CancellationToken cancellationToken = default ); /// /// remove an Item by it's Id ... /// /// /// /// /// /// [HttpDelete("{id}")] Task> Remove( [FromRoute] TKey id, [FromQuery] bool softDelete = true, [FromQuery] bool saveChanges = true, CancellationToken cancellationToken = default ); /// /// Check an Item exists or not ... /// /// /// /// /// [HttpGet("{id}/[action]")] Task> IsExists( [FromRoute] TKey id, [FromQuery] bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// count all exists Items ... /// /// /// /// [HttpGet("Count")] Task> Count( [FromQuery] bool ignoreSoftDeleteds = true, CancellationToken cancellationToken = default ); /// /// retrieve an Item by it's Id ... /// /// /// /// /// /// [HttpGet("{id}")] Task> Get( [FromRoute] TKey id, [FromQuery] bool ignoreSoftDeleteds = true, [FromQuery] bool useDefaultIncludes = false, CancellationToken cancellationToken = default ); /// /// retrieve all exists Items ... /// /// /// /// /// /// [HttpGet] Task>> GetAll( [FromQuery] bool ignoreSoftDeleteds = true, [FromQuery] bool useDefaultOrders = false, [FromQuery] bool useDefaultIncludes = false, CancellationToken cancellationToken = default ); /// /// find an Item by providing a Conditional Expression ... /// /// /// /// /// /// [HttpGet("FindOne")] Task> FindOne( [FromRoute] string query, [FromQuery] bool ignoreSoftDeleteds = true, [FromQuery] bool useDefaultIncludes = false, CancellationToken cancellationToken = default ); /// /// find a collection of Items by proving a Conditional Expression ... /// /// /// /// /// /// /// [HttpGet("FindMany")] Task>> FindMany( [FromRoute] string query, [FromQuery] bool ignoreSoftDeleteds = true, [FromQuery] bool useDefaultOrders = false, [FromQuery] bool useDefaultIncludes = false, CancellationToken cancellationToken = default ); /// /// retrieve Items based on XQuery Pagination structure ... /// /// /// /// /// /// /// [HttpGet("Query")] Task>> Query( [FromQuery] XQuery query, [FromQuery] bool ignoreSoftDeleteds = true, [FromQuery] bool useDefaultOrders = false, [FromQuery] bool useDefaultIncludes = false, CancellationToken cancellationToken = default ); #endregion // #region Non Actions ... /// /// Send Custom Push Message ... /// /// /// /// /// /// [NonAction] Task SendPush( string action, string payLoad, string connectionId = null, CancellationToken cancellationToken = default ); #endregion } }