[FA-misc] Switches to using DTOs, updates frontend with details and reader page, updates novel import to be an upsert
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using FictionArchive.Service.TranslationService.Models;
|
||||
using FictionArchive.Service.TranslationService.Models.Database;
|
||||
using FictionArchive.Service.TranslationService.Models.DTOs;
|
||||
using FictionArchive.Service.TranslationService.Services.Database;
|
||||
using FictionArchive.Service.TranslationService.Services.TranslationEngines;
|
||||
using HotChocolate.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using HotChocolate.Data;
|
||||
|
||||
namespace FictionArchive.Service.TranslationService.GraphQL;
|
||||
|
||||
@@ -22,8 +22,20 @@ public class Query
|
||||
[UseProjection]
|
||||
[UseFiltering]
|
||||
[UseSorting]
|
||||
public IQueryable<TranslationRequest> GetTranslationRequests(TranslationServiceDbContext dbContext)
|
||||
public IQueryable<TranslationRequestDto> GetTranslationRequests(TranslationServiceDbContext dbContext)
|
||||
{
|
||||
return dbContext.TranslationRequests.AsQueryable();
|
||||
return dbContext.TranslationRequests.Select(request => new TranslationRequestDto
|
||||
{
|
||||
Id = request.Id,
|
||||
CreatedTime = request.CreatedTime,
|
||||
LastUpdatedTime = request.LastUpdatedTime,
|
||||
OriginalText = request.OriginalText,
|
||||
TranslatedText = request.TranslatedText,
|
||||
From = request.From,
|
||||
To = request.To,
|
||||
TranslationEngineKey = request.TranslationEngineKey,
|
||||
Status = request.Status,
|
||||
BilledCharacterCount = request.BilledCharacterCount
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
using FictionArchive.Service.TranslationService.Models.Enums;
|
||||
using NodaTime;
|
||||
|
||||
namespace FictionArchive.Service.TranslationService.Models.DTOs;
|
||||
|
||||
public class TranslationRequestDto
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public Instant CreatedTime { get; init; }
|
||||
public Instant LastUpdatedTime { get; init; }
|
||||
public required string OriginalText { get; init; }
|
||||
public string? TranslatedText { get; init; }
|
||||
public Language From { get; init; }
|
||||
public Language To { get; init; }
|
||||
public required string TranslationEngineKey { get; init; }
|
||||
public TranslationRequestStatus Status { get; init; }
|
||||
public uint BilledCharacterCount { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user