[FA-misc] Add GraphQL job queries with filtering and pagination

This commit is contained in:
gamer147
2026-01-30 16:40:16 -05:00
parent 433f038051
commit 2c14ab4936
2 changed files with 28 additions and 0 deletions

View File

@@ -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>

View File

@@ -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;
}