[FA-misc] Reporting service now has a status page on the frontend
This commit is contained in:
@@ -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;
|
||||
}
|
||||
71
FictionArchive.Service.ReportingService/GraphQL/Query.cs
Normal file
71
FictionArchive.Service.ReportingService/GraphQL/Query.cs
Normal 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
|
||||
})
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user