Skip to content

Commit

Permalink
Merge branch 'master' into see-if-this-fixes-jobs-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
NateMerritt authored Dec 17, 2024
2 parents e83da14 + 8cbc347 commit 4443d6d
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Aquifer.Common.Messages.Models;

public sealed record TranslateLanguageResourcesMessage(
int LanguageId,
int ParentResourceId,
int StartedByUserId);
8 changes: 8 additions & 0 deletions src/Aquifer.Common/Messages/Models/TranslationOrigin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,12 @@ public enum TranslationOrigin
/// message handler. It will be set to <see cref="ResourceContentStatus.AquiferizeAiDraftComplete"/> status after aquiferization.
/// </summary>
CreateAquiferization,

/// <summary>
/// Not triggered by a user flow; manually dev triggered only.
/// Translates all resources in a parent resource into a target language where those resources
/// don't yet have any resource contents in that target language.
/// Each translated ResourceContentVersion will be published and the ResourceContent will be marked as Complete.
/// </summary>
Language,
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ namespace Aquifer.Common.Messages.Publishers;

public interface ITranslationMessagePublisher
{
public Task PublishTranslateLanguageResourcesMessageAsync(
TranslateLanguageResourcesMessage message,
CancellationToken cancellationToken);

public Task PublishTranslateProjectResourcesMessageAsync(
TranslateProjectResourcesMessage message,
CancellationToken cancellationToken);
Expand All @@ -15,6 +19,14 @@ public Task PublishTranslateResourceMessageAsync(

public sealed class TranslationMessagePublisher(IQueueClientFactory _queueClientFactory) : ITranslationMessagePublisher
{
public async Task PublishTranslateLanguageResourcesMessageAsync(
TranslateLanguageResourcesMessage message,
CancellationToken cancellationToken)
{
var queueClient = await _queueClientFactory.GetQueueClientAsync(Queues.TranslateLanguageResources, cancellationToken);
await queueClient.SendMessageAsync(message, cancellationToken: cancellationToken);
}

public async Task PublishTranslateProjectResourcesMessageAsync(
TranslateProjectResourcesMessage message,
CancellationToken cancellationToken)
Expand Down
1 change: 1 addition & 0 deletions src/Aquifer.Common/Messages/Queues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static class Queues
public const string TrackResourceContentRequest = "track-resource-content-request";

// translations
public const string TranslateLanguageResources = "translate-language-resources";
public const string TranslateProjectResources = "translate-project-resources";
public const string TranslateResource = "translate-resource";

Expand Down
Loading

0 comments on commit 4443d6d

Please sign in to comment.