Skip to content

Commit

Permalink
Merge branch 'main' into performance/improve-serviceowner-search-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dagfinno committed Feb 28, 2025
2 parents 54c1b2f + 7a506b3 commit 39474dd
Show file tree
Hide file tree
Showing 12 changed files with 2,349 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ Deployments are done using `GitHub Actions` with the following steps:
- **Purpose**: This generates a changelog and bumps the version number.
- **Merge**: Merge the release pull request into the `main` branch.

#### 4. Deploy to Staging (Bump Version and Create Tag)
#### 4. Deploy to Staging and YT01 (Bump Version and Create Tag)
- **Trigger**: Merging the release pull request.
- **Action**:
- Bumps the version number.
Expand Down Expand Up @@ -371,7 +371,7 @@ The `dispatch-apps.yml` workflow is responsible for deploying applications. To t
2. Select the `Dispatch Apps` workflow.
3. Click on "Run workflow".
4. Fill in the required inputs:
- **environment**: Choose the target environment (`test`, `staging`, or `prod`).
- **environment**: Choose the target environment (`test`, `yt01`, `staging`, or `prod`).
- **version**: Specify the version to deploy. Could be git tag or a docker-tag published in packages.
- **runMigration** (optional): Indicate whether to run database migrations (`true` or `false`).

Expand All @@ -385,7 +385,7 @@ The `dispatch-infrastructure.yml` workflow is used for deploying infrastructure
2. Select the `Dispatch Infrastructure` workflow.
3. Click on "Run workflow".
4. Provide the necessary inputs:
- **environment**: Select the environment you wish to deploy to (`test`, `staging`, or `prod`).
- **environment**: Select the environment you wish to deploy to (`test`, `yt01`, `staging`, or `prod`).
- **version**: Enter the version to deploy, which should correspond to a git tag. (e.g., `1.23.4`).

This workflow facilitates the deployment of infrastructure to the specified environment, using the version details provided.
Expand Down
Binary file modified docs/deploy-process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Digdir.Domain.Dialogporten.Domain.Common;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using static Digdir.Domain.Dialogporten.Domain.Common.Constants;

namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Configurations.Dialogs;

Expand All @@ -11,7 +11,7 @@ public void Configure(EntityTypeBuilder<DialogEntity> builder)
{
builder.ToTable("Dialog");
builder.Property(x => x.ServiceResource)
.HasMaxLength(Constants.DefaultMaxStringLength);
.HasMaxLength(DefaultMaxStringLength);
builder.HasIndex(x => x.CreatedAt);
builder.HasIndex(x => x.DueAt);
builder.HasIndex(x => x.UpdatedAt);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using Digdir.Domain.Dialogporten.Domain.Common;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using static Digdir.Domain.Dialogporten.Domain.Common.Constants;

namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Configurations.Dialogs;

internal sealed class DialogSearchTagConfiguration : IEntityTypeConfiguration<DialogSearchTag>
{
public void Configure(EntityTypeBuilder<DialogSearchTag> builder)
{
builder.HasIndex(x => new { x.DialogId, x.Value })
.IsUnique();
builder.Property(x => x.Value)
.HasMaxLength(Constants.MaxSearchTagLength);
.HasMaxLength(MaxSearchTagLength);

builder.HasIndex(x => x.Value)
.HasMethod(Constants.Gin)
.HasOperators(Constants.GinTrgmOps);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ public void Configure(EntityTypeBuilder<Localization> builder)
builder.HasKey(x => new { x.LocalizationSetId, CultureCode = x.LanguageCode });
builder.Property(x => x.LanguageCode).HasMaxLength(15);
builder.Property(x => x.Value).HasMaxLength(4095);

builder.HasIndex(x => x.Value)
.HasMethod(Constants.Gin)
.HasOperators(Constants.GinTrgmOps);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence;

internal static class Constants
{
internal const string Gin = "gin";
internal const string GinTrgmOps = "gin_trgm_ops";
internal const string PostgreSqlTrigram = "pg_trgm";
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public async Task<List<Guid>> GetExistingIds<TEntity>(

protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.Properties<string>(x => x.HaveMaxLength(Constants.DefaultMaxStringLength));
configurationBuilder.Properties<Uri>(x => x.HaveMaxLength(Constants.DefaultMaxUriLength));
configurationBuilder.Properties<string>(x => x.HaveMaxLength(Domain.Common.Constants.DefaultMaxStringLength));
configurationBuilder.Properties<Uri>(x => x.HaveMaxLength(Domain.Common.Constants.DefaultMaxUriLength));
configurationBuilder.Properties<DateTimeOffset>().HaveConversion<DateTimeOffsetConverter>();
configurationBuilder.Properties<TimeSpan>().HaveConversion<TimeSpanToStringConverter>();
}
Expand All @@ -113,6 +113,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)


modelBuilder
.HasPostgresExtension(Constants.PostgreSqlTrigram)
.RemovePluralizingTableNameConvention()
.AddAuditableEntities()
.ApplyConfigurationsFromAssembly(typeof(DialogDbContext).Assembly)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Digdir.Domain.Dialogporten.Domain.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using static Digdir.Domain.Dialogporten.Domain.Common.Constants;

namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.IdempotentNotifications;

Expand All @@ -17,7 +18,7 @@ public void Configure(EntityTypeBuilder<NotificationAcknowledgement> builder)
{
builder.HasKey(x => new { x.EventId, x.NotificationHandler });
builder.HasIndex(x => x.EventId);
builder.Property(x => x.NotificationHandler).HasMaxLength(Constants.DefaultMaxStringLength);
builder.Property(x => x.NotificationHandler).HasMaxLength(DefaultMaxStringLength);
builder.Property(x => x.AcknowledgedAt).HasDefaultValueSql("current_timestamp at time zone 'utc'");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using MassTransit;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Logging;
using Constants = Digdir.Domain.Dialogporten.Infrastructure.GraphQl.GraphQlSubscriptionConstants;

namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Interceptors;

Expand Down Expand Up @@ -103,7 +102,7 @@ public override async ValueTask<int> SavedChangesAsync(SaveChangesCompletedEvent
.Where(x => x is not null)
.Cast<DialogEventPayload>()
.Select(x => _topicEventSender.Value.SendAsync(
$"{Constants.DialogEventsTopic}{x.Id}",
$"{GraphQlSubscriptionConstants.DialogEventsTopic}{x.Id}",
x,
cancellationToken)
.AsTask());
Expand Down
Loading

0 comments on commit 39474dd

Please sign in to comment.