[FA-misc] Add GraphQL job queries with filtering and pagination
This commit is contained in:
@@ -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