Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

Commit

Permalink
feat(back-end): Add 'GetPendingActivitiesToConfirmed' method in Activ…
Browse files Browse the repository at this point in the history
…itiesRepository
  • Loading branch information
CarlosPavajeau committed Jan 27, 2021
1 parent deeda13 commit 2527c69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Domain/Repositories/IActivitiesRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public interface IActivitiesRepository : IRepositoryBase<Activity, int>

Task<IEnumerable<Activity>> GetPendingClientActivities(string clientId);
Task<IEnumerable<Activity>> GetAppliedClientActivities(string clientId);

Task<IEnumerable<Activity>> GetPendingActivitiesToConfirmed();
}
}
15 changes: 15 additions & 0 deletions Infrastructure/Repositories/ActivitiesRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,20 @@ public async Task<IEnumerable<Activity>> GetAppliedClientActivities(string clien
{
return await GetClientActivities(clientId, ActivityState.Applied);
}

public async Task<IEnumerable<Activity>> GetPendingActivitiesToConfirmed()
{
DateTime today = DateTime.Now;

return await GetAll()
.Include(a => a.Client)
.ThenInclude(c => c.User)
.Where(
a => a.State == ActivityState.Pending &&
MySqlDbFunctionsExtensions.DateDiffDay(EF.Functions, a.Date, today) <= 3 &&
MySqlDbFunctionsExtensions.DateDiffDay(EF.Functions, a.Date, today) > 0
)
.ToListAsync();
}
}
}

0 comments on commit 2527c69

Please sign in to comment.