[FA-misc] Add GraphQL job queries with filtering and pagination
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HotChocolate.AspNetCore" Version="15.1.11" />
|
||||
<PackageReference Include="HotChocolate.Data.EntityFramework" Version="15.1.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.11">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using FictionArchive.Service.ReportingService.Models;
|
||||
using FictionArchive.Service.ReportingService.Services;
|
||||
using HotChocolate.Authorization;
|
||||
using HotChocolate.Data;
|
||||
|
||||
namespace FictionArchive.Service.ReportingService.GraphQL;
|
||||
|
||||
[QueryType]
|
||||
public static class JobQueries
|
||||
{
|
||||
[UseProjection]
|
||||
[Authorize]
|
||||
[UseFirstOrDefault]
|
||||
public static IQueryable<Job> GetJobById(
|
||||
Guid jobId,
|
||||
ReportingDbContext db)
|
||||
=> db.Jobs.Where(j => j.Id == jobId);
|
||||
|
||||
[UsePaging]
|
||||
[UseProjection]
|
||||
[UseFiltering]
|
||||
[UseSorting]
|
||||
[Authorize]
|
||||
public static IQueryable<Job> GetJobs(ReportingDbContext db)
|
||||
=> db.Jobs;
|
||||
}
|
||||
Reference in New Issue
Block a user