[FA-misc] Mass transit overhaul, needs testing and review
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Commands;
|
||||
|
||||
public record ImportNovelCommand : ICommand
|
||||
{
|
||||
public required string NovelUrl { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Commands;
|
||||
|
||||
public record PullChapterContentCommand : ICommand
|
||||
{
|
||||
public required uint NovelId { get; init; }
|
||||
public required uint VolumeId { get; init; }
|
||||
public required uint ChapterOrder { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Commands;
|
||||
|
||||
public record TranslateTextCommand : ICommand
|
||||
{
|
||||
public Guid TranslationRequestId { get; init; }
|
||||
public Language From { get; init; }
|
||||
public Language To { get; init; }
|
||||
public required string Body { get; init; }
|
||||
public required string TranslationEngineKey { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Commands;
|
||||
|
||||
public record UploadFileCommand : ICommand
|
||||
{
|
||||
public Guid RequestId { get; init; }
|
||||
public required string FilePath { get; init; }
|
||||
public required byte[] FileData { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
|
||||
public record AuthUserAddedEvent : IEvent
|
||||
{
|
||||
public required string OAuthProviderId { get; init; }
|
||||
public required string InviterOAuthProviderId { get; init; }
|
||||
public required string EventUserEmail { get; init; }
|
||||
public required string EventUserUsername { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
|
||||
public record ChapterCreatedEvent : IEvent
|
||||
{
|
||||
public required uint ChapterId { get; init; }
|
||||
public required uint NovelId { get; init; }
|
||||
public required uint VolumeId { get; init; }
|
||||
public required int VolumeOrder { get; init; }
|
||||
public required uint ChapterOrder { get; init; }
|
||||
public required string ChapterTitle { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
|
||||
public record FileUploadCompletedEvent : IEvent
|
||||
{
|
||||
public Guid RequestId { get; init; }
|
||||
public RequestStatus Status { get; init; }
|
||||
public string? FileAccessUrl { get; init; }
|
||||
public string? ErrorMessage { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
|
||||
public record NovelCreatedEvent : IEvent
|
||||
{
|
||||
public required uint NovelId { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public required Language OriginalLanguage { get; init; }
|
||||
public required string Source { get; init; }
|
||||
public required string AuthorName { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
|
||||
public record TranslationCompletedEvent : IEvent
|
||||
{
|
||||
public Guid TranslationRequestId { get; init; }
|
||||
public required string TranslatedText { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
|
||||
public record UserInvitedEvent : IEvent
|
||||
{
|
||||
public Guid InvitedUserId { get; init; }
|
||||
public required string InvitedUsername { get; init; }
|
||||
public required string InvitedEmail { get; init; }
|
||||
public required string InvitedOAuthProviderId { get; init; }
|
||||
|
||||
public Guid InviterId { get; init; }
|
||||
public required string InviterUsername { get; init; }
|
||||
public required string InviterOAuthProviderId { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Marker interface for commands (do something, single consumer)
|
||||
/// </summary>
|
||||
public interface ICommand { }
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Marker interface for events (something happened, multiple subscribers)
|
||||
/// </summary>
|
||||
public interface IEvent { }
|
||||
@@ -0,0 +1,18 @@
|
||||
using NodaTime;
|
||||
|
||||
namespace FictionArchive.Service.Shared.MassTransit.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Published by sagas on state transitions for centralized job tracking
|
||||
/// </summary>
|
||||
public record JobStateChangedEvent : IEvent
|
||||
{
|
||||
public Guid JobId { get; init; }
|
||||
public required string JobType { get; init; }
|
||||
public required string FromState { get; init; }
|
||||
public required string ToState { get; init; }
|
||||
public string? Message { get; init; }
|
||||
public string? Error { get; init; }
|
||||
public Instant Timestamp { get; init; }
|
||||
public Dictionary<string, object>? Metadata { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user