[FA-misc] Reporting service now has a status page on the frontend

This commit is contained in:
gamer147
2026-02-01 12:07:57 -05:00
parent 9bc39c3abf
commit 7ccc3ade9e
18 changed files with 1046 additions and 31 deletions

View File

@@ -1,26 +0,0 @@
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;
}

View File

@@ -0,0 +1,71 @@
using FictionArchive.Service.ReportingService.Models.DTOs;
using FictionArchive.Service.ReportingService.Services;
using HotChocolate.Authorization;
using HotChocolate.Data;
namespace FictionArchive.Service.ReportingService.GraphQL;
public class Query
{
[Authorize]
//[UseProjection]
[UseFirstOrDefault]
public IQueryable<JobDto> GetJobById(
Guid jobId,
ReportingDbContext db)
=> db.Jobs.Where(j => j.Id == jobId).Select(j => new JobDto
{
Id = j.Id,
CreatedTime = j.CreatedTime,
LastUpdatedTime = j.LastUpdatedTime,
ParentJobId = j.ParentJobId,
JobType = j.JobType,
DisplayName = j.DisplayName,
Status = j.Status,
ErrorMessage = j.ErrorMessage,
Metadata = j.Metadata,
ChildJobs = j.ChildJobs.Select(c => new JobDto
{
Id = c.Id,
CreatedTime = c.CreatedTime,
LastUpdatedTime = c.LastUpdatedTime,
ParentJobId = c.ParentJobId,
JobType = c.JobType,
DisplayName = c.DisplayName,
Status = c.Status,
ErrorMessage = c.ErrorMessage,
Metadata = c.Metadata
})
});
[Authorize]
[UsePaging]
//[UseProjection]
[UseFiltering]
[UseSorting]
public IQueryable<JobDto> GetJobs(ReportingDbContext db)
=> db.Jobs.Select(j => new JobDto
{
Id = j.Id,
CreatedTime = j.CreatedTime,
LastUpdatedTime = j.LastUpdatedTime,
ParentJobId = j.ParentJobId,
JobType = j.JobType,
DisplayName = j.DisplayName,
Status = j.Status,
ErrorMessage = j.ErrorMessage,
Metadata = j.Metadata,
ChildJobs = j.ChildJobs.Select(c => new JobDto
{
Id = c.Id,
CreatedTime = c.CreatedTime,
LastUpdatedTime = c.LastUpdatedTime,
ParentJobId = c.ParentJobId,
JobType = c.JobType,
DisplayName = c.DisplayName,
Status = c.Status,
ErrorMessage = c.ErrorMessage,
Metadata = c.Metadata
})
});
}