Skip to content

Commit

Permalink
Added person search service against TRS DB (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha authored Feb 5, 2024
1 parent 142dc66 commit 25ef7fa
Show file tree
Hide file tree
Showing 21 changed files with 1,946 additions and 4 deletions.
1 change: 1 addition & 0 deletions TeachingRecordSystem/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<PackageVersion Include="idunno.Authentication.Basic" Version="2.3.1" />
<PackageVersion Include="Joonasw.AspNetCore.SecurityHeaders" Version="5.0.0" />
<PackageVersion Include="JustEat.HttpClientInterception" Version="4.1.0" />
<PackageVersion Include="LinqKit" Version="1.2.5" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using TeachingRecordSystem.AuthorizeAccess.TagHelpers;
using TeachingRecordSystem.Core;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Services.PersonSearch;
using TeachingRecordSystem.FormFlow;
using TeachingRecordSystem.ServiceDefaults;
using TeachingRecordSystem.SupportUi.Infrastructure.FormFlow;
Expand Down Expand Up @@ -101,7 +102,8 @@
})
.AddSingleton<ICurrentUserIdProvider, DummyCurrentUserIdProvider>()
.AddTransient<SignInJourneyHelper>()
.AddSingleton<ITagHelperInitializer<FormTagHelper>, FormTagHelperInitializer>();
.AddSingleton<ITagHelperInitializer<FormTagHelper>, FormTagHelperInitializer>()
.AddPersonSearch();

builder.Services.AddOptions<AuthorizeAccessOptions>()
.Bind(builder.Configuration)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TeachingRecordSystem.Core.DataStore.Postgres.Models;

namespace TeachingRecordSystem.Core.DataStore.Postgres.Mappings;

public class NameSynonymsMapping : IEntityTypeConfiguration<NameSynonyms>
{
public void Configure(EntityTypeBuilder<NameSynonyms> builder)
{
builder.ToTable("name_synonyms");
builder.HasKey(e => e.NameSynonymsId);
builder.Property(e => e.Name).HasMaxLength(NameSynonyms.NameMaxLength).IsRequired().UseCollation("case_insensitive");
builder.HasIndex(e => e.Name).IsUnique().HasDatabaseName(NameSynonyms.NameSynonymsIndexName);
builder.Property(e => e.Synonyms).IsRequired().UseCollation("case_insensitive");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TeachingRecordSystem.Core.DataStore.Postgres.Models;

namespace TeachingRecordSystem.Core.DataStore.Postgres.Mappings;

public class PersonSearchAttributeMapping : IEntityTypeConfiguration<PersonSearchAttribute>
{
public void Configure(EntityTypeBuilder<PersonSearchAttribute> builder)
{
builder.ToTable("person_search_attributes");
builder.HasKey(e => e.PersonSearchAttributeId);
builder.Property(e => e.PersonId).IsRequired();
builder.HasIndex(e => e.PersonId).HasDatabaseName(PersonSearchAttribute.PersonIdIndexName);
builder.Property(e => e.AttributeType).HasMaxLength(PersonSearchAttribute.AttributeTypeMaxLength).IsRequired().UseCollation("case_insensitive");
builder.Property(e => e.AttributeValue).HasMaxLength(PersonSearchAttribute.AttributeValueMaxLength).IsRequired().UseCollation("case_insensitive");
builder.Property(e => e.AttributeKey).HasMaxLength(PersonSearchAttribute.AttributeKeyMaxLength).UseCollation("case_insensitive");
builder.HasIndex(e => new { e.AttributeType, e.AttributeValue }).HasDatabaseName(PersonSearchAttribute.AttributeTypeAndValueIndexName);
}
}
Loading

0 comments on commit 25ef7fa

Please sign in to comment.