Skip to content

Commit

Permalink
Merge branch 'main' into chore/add-empty-assertion-on-infrastructure-…
Browse files Browse the repository at this point in the history
…internal-classes-test
  • Loading branch information
oskogstad authored Sep 20, 2024
2 parents 268d5a5 + c2559d8 commit f7c80a6
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .azure/modules/containerApp/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ param tags object
param resources object?

@description('The suffix for the revision of the container app')
param revisionSuffix string?
param revisionSuffix string

// Container app revision name does not allow '.' character
var cleanedRevisionSuffix = replace(revisionSuffix, '.', '-')

var probes = [
{
Expand Down Expand Up @@ -78,7 +81,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
}
environmentId: containerAppEnvId
template: {
revisionSuffix: revisionSuffix
revisionSuffix: cleanedRevisionSuffix
scale: {
minReplicas: 1
maxReplicas: 1 // temp disable scaling for outbox scheduling
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/action-check-for-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
- '.github/**/*'
- 'src/**/*'
- '.azure/applications/**/*'
- '.azure/modules/containerApp/**/*'
tests:
- 'tests/**/*'
azure:
Expand Down
12 changes: 9 additions & 3 deletions docs/schema/V1/schema.verified.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ type DialogByIdPayload {
errors: [DialogByIdError!]!
}

type DialogUpdatedPayload {
type DialogEventPayload {
id: UUID!
type: DialogEventType!
}

type GuiAction {
Expand Down Expand Up @@ -211,7 +212,7 @@ type SeenLog {
}

type Subscriptions @authorize(policy: "enduser") {
dialogUpdated(dialogId: UUID!): DialogUpdatedPayload!
dialogEvents(dialogId: UUID!): DialogEventPayload!
}

type Transmission {
Expand Down Expand Up @@ -296,6 +297,11 @@ enum AttachmentUrlConsumer {
API
}

enum DialogEventType {
DIALOG_UPDATED
DIALOG_DELETED
}

enum DialogStatus {
"The dialogue is considered new. Typically used for simple messages that do not require any interaction, or as an initial step for dialogues. This is the default."
NEW
Expand Down Expand Up @@ -355,4 +361,4 @@ scalar DateTime @specifiedBy(url: "https:\/\/www.graphql-scalars.com\/date-time"

scalar URL @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc3986")

scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122")
scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122")
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,14 @@ public enum AttachmentUrlConsumer
Api = 2
}

public sealed class DialogUpdatedPayload
public sealed class DialogEventPayload
{
public Guid Id { get; set; }
public DialogEventType Type { get; set; }
}

public enum DialogEventType
{
DialogUpdated = 1,
DialogDeleted = 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ namespace Digdir.Domain.Dialogporten.GraphQL.EndUser.DialogById;
public sealed class Subscriptions
{
[Subscribe]
[Topic($"{Constants.DialogUpdatedTopic}{{{nameof(dialogId)}}}")]
public DialogUpdatedPayload DialogUpdated(Guid dialogId,
[EventMessage] Guid eventMessage)
[Topic($"{Constants.DialogEventsTopic}{{{nameof(dialogId)}}}")]
public DialogEventPayload DialogEvents(Guid dialogId,
[EventMessage] DialogEventPayload eventMessage)
{
ArgumentNullException.ThrowIfNull(dialogId);
ArgumentNullException.ThrowIfNull(eventMessage);
return new DialogUpdatedPayload { Id = dialogId };
return eventMessage;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Digdir.Domain.Dialogporten.Application.Common;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Events;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Events.Activities;
using Digdir.Domain.Dialogporten.Domain.Outboxes;
using Digdir.Domain.Dialogporten.Infrastructure.GraphQl;
using Digdir.Library.Entity.Abstractions.Features.EventPublisher;
using HotChocolate.Subscriptions;
using Microsoft.EntityFrameworkCore.Diagnostics;
Expand Down Expand Up @@ -72,8 +74,28 @@ public override async ValueTask<int> SavedChangesAsync(SaveChangesCompletedEvent
var task = domainEvent switch
{
DialogUpdatedDomainEvent dialogUpdatedDomainEvent => _topicEventSender.SendAsync(
$"{Constants.DialogUpdatedTopic}{dialogUpdatedDomainEvent.DialogId}",
dialogUpdatedDomainEvent.DialogId,
$"{Constants.DialogEventsTopic}{dialogUpdatedDomainEvent.DialogId}",
new DialogEventPayload
{
Id = dialogUpdatedDomainEvent.DialogId,
Type = DialogEventType.DialogUpdated
},
cancellationToken),
DialogDeletedDomainEvent dialogDeletedDomainEvent => _topicEventSender.SendAsync(
$"{Constants.DialogEventsTopic}{dialogDeletedDomainEvent.DialogId}",
new DialogEventPayload
{
Id = dialogDeletedDomainEvent.DialogId,
Type = DialogEventType.DialogDeleted
},
cancellationToken),
DialogActivityCreatedDomainEvent dialogActivityCreatedDomainEvent => _topicEventSender.SendAsync(
$"{Constants.DialogEventsTopic}{dialogActivityCreatedDomainEvent.DialogId}",
new DialogEventPayload
{
Id = dialogActivityCreatedDomainEvent.DialogId,
Type = DialogEventType.DialogUpdated
},
cancellationToken),
_ => ValueTask.CompletedTask
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Digdir.Domain.Dialogporten.Infrastructure.GraphQl;

internal struct DialogEventPayload
{
public Guid Id { get; set; }
public DialogEventType Type { get; set; }
}

internal enum DialogEventType
{
DialogUpdated = 1,
DialogDeleted = 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ namespace Digdir.Domain.Dialogporten.Infrastructure.GraphQl;
public static class GraphQlSubscriptionConstants
{
public const string SubscriptionTopicPrefix = "graphql_subscriptions_";
public const string DialogUpdatedTopic = "dialogUpdated/";
public const string DialogEventsTopic = "dialogEvents/";
}

0 comments on commit f7c80a6

Please sign in to comment.