using Prefab.Domain.Common; namespace Prefab.Data.Queries; /// /// Provides reusable audit-related query filters for entity sets. /// public static class EntityAuditQueries { /// /// Filters entities created before the specified timestamp. /// public static IQueryable ThatWasCreateBefore(this IQueryable query, DateTime dateTime) => query.Where(x => x.CreatedOn < dateTime); /// /// Filters entities created after the specified timestamp. /// public static IQueryable ThatWasCreatedAfter(this IQueryable query, DateTime dateTime) => query.Where(x => x.CreatedOn > dateTime); /// /// Filters entities created between the specified start and end timestamps. /// public static IQueryable ThatWasCreatedBetween(this IQueryable query, DateTime start, DateTime end) => query.ThatWasCreatedAfter(start).ThatWasCreateBefore(end); /// /// Filters entities last modified before the specified timestamp. /// public static IQueryable ThatWasLastModifiedBefore(this IQueryable query, DateTime dateTime) => query.Where(x => x.LastModifiedOn < dateTime); /// /// Filters entities last modified after the specified timestamp. /// public static IQueryable ThatWasLastModifiedAfter(this IQueryable query, DateTime dateTime) => query.Where(x => x.LastModifiedOn > dateTime); /// /// Filters entities last modified between the specified start and end timestamps. /// public static IQueryable ThatWasLastModifiedBetween(this IQueryable query, DateTime start, DateTime end) => query.ThatWasLastModifiedAfter(start).ThatWasLastModifiedBefore(end); }