-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Endpoint "getAssociatedPersonsWithtrust" (#621)
* Added GetAllPersonsAssociatedWithTrust endpoint
- Loading branch information
1 parent
b6d46b6
commit 057b0d3
Showing
79 changed files
with
1,064 additions
and
720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
Dfe.Academies.Api.Infrastructure/QueryServices/EstablishmentQueryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Dfe.Academies.Api.Infrastructure/QueryServices/TrustQueryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Dfe.Academies.Application.Common.Interfaces; | ||
using Dfe.Academies.Application.Common.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Dfe.Academies.Infrastructure.QueryServices | ||
{ | ||
internal class TrustQueryService(MstrContext context) : ITrustQueryService | ||
{ | ||
public IQueryable<TrustGovernanceQueryModel?>? GetTrustGovernanceByGroupIdOrUkprn(string? groupId, string? ukPrn) | ||
{ | ||
|
||
// Check if the trust exists based on GroupID or UKPRN | ||
var trustExists = context.Trusts.AsNoTracking().Any(t => | ||
(!string.IsNullOrEmpty(groupId) && t.GroupID == groupId) || | ||
(!string.IsNullOrEmpty(ukPrn) && t.UKPRN == ukPrn)); | ||
|
||
if (!trustExists) | ||
{ | ||
return null; | ||
} | ||
|
||
var query = from t in context.Trusts.AsNoTracking() | ||
join tg in context.TrustGovernances.AsNoTracking() | ||
on t.SK equals tg.TrustId | ||
join grt in context.GovernanceRoleTypes.AsNoTracking() | ||
on tg.GovernanceRoleTypeId equals grt.SK | ||
where (!string.IsNullOrEmpty(groupId) && t.GroupID == groupId) || | ||
(!string.IsNullOrEmpty(ukPrn) && t.UKPRN == ukPrn) | ||
select new TrustGovernanceQueryModel(t, grt, tg); | ||
|
||
return query; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 0 additions & 194 deletions
194
Dfe.Academies.Api.Infrastructure/Repositories/Repository.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Dfe.Academies.Application/Common/Interfaces/IEstablishmentQueryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Dfe.Academies.Application/Common/Interfaces/ITrustQueryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Dfe.Academies.Application.Common.Models; | ||
|
||
namespace Dfe.Academies.Application.Common.Interfaces | ||
{ | ||
public interface ITrustQueryService | ||
{ | ||
IQueryable<TrustGovernanceQueryModel?>? GetTrustGovernanceByGroupIdOrUkprn(string? groupId, string? ukPrn); | ||
} | ||
} |
Oops, something went wrong.