33// See README in the root project for more information.
44// ============================================================================
55
6+ using System . Linq . Expressions ;
67using NXTBackend . API . Domain . Common ;
78using NXTBackend . API . Models ;
89
@@ -19,46 +20,54 @@ namespace NXTBackend.API.Core;
1920/// <typeparam name="T">The model type.</typeparam>
2021public interface IDomainService < T > where T : BaseEntity
2122{
22- /// <summary>
23- /// Find the entity by its ID .
24- /// </summary>
25- /// <param name="id">The ID .</param>
26- /// <returns>The entity found by that ID or null if not found .</returns>
27- public Task < T ? > FindByIdAsync ( Guid id ) ;
23+ /// <summary>
24+ /// Configures the query to include related entities .
25+ /// </summary>
26+ /// <param name="includeExpression">Expression that defines the related entity to include .</param>
27+ /// <returns>The service instance for method chaining .</returns>
28+ IDomainService < T > Include ( Expression < Func < T , object > > includeExpression ) ;
2829
29- /// <summary>
30- /// Update the entity.
31- /// </summary>
32- /// <param name="entity ">The updated entity .</param>
33- /// <returns>The updated entity.</returns>
34- public Task < T > UpdateAsync ( T entity ) ;
30+ /// <summary>
31+ /// Find the entity by its ID .
32+ /// </summary>
33+ /// <param name="id ">The ID .</param>
34+ /// <returns>The entity found by that ID or null if not found .</returns>
35+ Task < T ? > FindByIdAsync ( Guid id ) ;
3536
36- /// <summary>
37- ///
38- /// </summary>
39- /// <param name="ids"> </param>
40- /// <returns></returns>
41- public Task < bool > AreValid ( IEnumerable < Guid > ids ) ;
37+ /// <summary>
38+ /// Update the entity.
39+ /// </summary>
40+ /// <param name="entity">The updated entity. </param>
41+ /// <returns>The updated entity. </returns>
42+ Task < T > UpdateAsync ( T entity ) ;
4243
44+ /// <summary>
45+ /// Validates if all provided IDs exist in the database.
46+ /// </summary>
47+ /// <param name="ids">Collection of IDs to validate.</param>
48+ /// <returns>True if all IDs are valid, false otherwise.</returns>
49+ Task < bool > AreValid ( IEnumerable < Guid > ids ) ;
4350
44- /// <summary>
45- /// Delete the entity.
46- /// </summary>
47- /// <param name="entity">The entity to delete</param>
48- /// <returns>The deleted entity.</returns>
49- public Task < T > DeleteAsync ( T entity ) ;
51+ /// <summary>
52+ /// Delete the entity.
53+ /// </summary>
54+ /// <param name="entity">The entity to delete</param>
55+ /// <returns>The deleted entity.</returns>
56+ Task < T > DeleteAsync ( T entity ) ;
5057
51- /// <summary>
52- /// Create a new entity.
53- /// </summary>
54- /// <param name="entity">The newly created entity.</param>
55- /// <returns>The newly created entity.</returns>
56- public Task < T > CreateAsync ( T entity ) ;
58+ /// <summary>
59+ /// Create a new entity.
60+ /// </summary>
61+ /// <param name="entity">The newly created entity.</param>
62+ /// <returns>The newly created entity.</returns>
63+ Task < T > CreateAsync ( T entity ) ;
5764
58- /// <summary>
59- /// Get all entities.
60- /// </summary>
61- /// <param name="pagination">Specific pagination parameters (as to avoid large queries)</param>
62- /// <returns>A paginated list of entities.</returns>
63- public Task < PaginatedList < T > > GetAllAsync ( PaginationParams pagination , SortingParams sorting , FilterDictionary ? filter = null ) ;
64- }
65+ /// <summary>
66+ /// Get all entities.
67+ /// </summary>
68+ /// <param name="pagination">Specific pagination parameters (as to avoid large queries)</param>
69+ /// <param name="sorting">Parameters for sorting the results</param>
70+ /// <param name="filter">Optional filters to apply to the query</param>
71+ /// <returns>A paginated list of entities.</returns>
72+ Task < PaginatedList < T > > GetAllAsync ( PaginationParams pagination , SortingParams sorting , FilterDictionary ? filter = null ) ;
73+ }
0 commit comments