-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ local.env | |
cookies.txt | ||
dump.sql | ||
test-results/ | ||
**/*.sqlite | ||
**/*.sqlite-* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using LexCore.ServiceInterfaces; | ||
using LfClassicData; | ||
using MongoDB.Driver; | ||
using MongoDB.Driver.Linq; | ||
|
||
namespace LexBoxApi.GraphQL.CustomTypes; | ||
|
||
public class IsLanguageForgeProjectDataLoader : BatchDataLoader<string, bool>, IIsLanguageForgeProjectDataLoader | ||
{ | ||
private readonly SystemDbContext _systemDbContext; | ||
|
||
public IsLanguageForgeProjectDataLoader( | ||
SystemDbContext systemDbContext, | ||
IBatchScheduler batchScheduler, | ||
DataLoaderOptions? options = null) | ||
: base(batchScheduler, options) | ||
{ | ||
_systemDbContext = systemDbContext; | ||
} | ||
|
||
protected override async Task<IReadOnlyDictionary<string, bool>> LoadBatchAsync( | ||
IReadOnlyList<string> projectCodes, | ||
CancellationToken cancellationToken) | ||
{ | ||
return await MongoExtensions.ToAsyncEnumerable(_systemDbContext.Projects.AsQueryable() | ||
.Select(p => p.ProjectCode) | ||
.Where(projectCode => projectCodes.Contains(projectCode))) | ||
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Build API / publish-api
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (ubuntu-latest, 3) / Test ubuntu-latest for Mercurial 3 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (ubuntu-latest, 3) / Test ubuntu-latest for Mercurial 3 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (windows-latest, 3) / Test windows-latest for Mercurial 3 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (windows-latest, 3) / Test windows-latest for Mercurial 3 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (windows-latest, 6) / Test windows-latest for Mercurial 6 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (windows-latest, 6) / Test windows-latest for Mercurial 6 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (ubuntu-latest, 6) / Test ubuntu-latest for Mercurial 6 on staging
Check warning on line 27 in backend/LexBoxApi/GraphQL/CustomTypes/IsLanguageForgeProjectDataLoader.cs GitHub Actions / Integration tests (ubuntu-latest, 6) / Test ubuntu-latest for Mercurial 6 on staging
|
||
.ToDictionaryAsync(projectCode => projectCode, _ => true, cancellationToken); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace LexCore.ServiceInterfaces; | ||
|
||
public interface IIsLanguageForgeProjectDataLoader | ||
{ | ||
public Task<bool> LoadAsync(string projectCode, CancellationToken cancellationToken = default); | ||
} |