From e4d9ec773b00d395f1804422c2c6060c7da2156c Mon Sep 17 00:00:00 2001 From: githubjimmeicatt Date: Thu, 31 Oct 2024 11:21:07 +0100 Subject: [PATCH 01/10] add bronnen voor migrations --- .../Contactmomenten/BronModel.cs | 20 + .../ContactmomentDetailsModel.cs | 2 + .../ContactmomentDetailsToevoegen.cs | 28 +- Kiss.Bff/Intern/Data/BeheerDbContext.cs | 6 + .../20241031100726_AddBronModel.Designer.cs | 395 ++++++++++++++++++ .../Migrations/20241031100726_AddBronModel.cs | 46 ++ .../BeheerDbContextModelSnapshot.cs | 51 ++- 7 files changed, 545 insertions(+), 3 deletions(-) create mode 100644 Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs create mode 100644 Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs create mode 100644 Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs new file mode 100644 index 00000000..07fa6a36 --- /dev/null +++ b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Kiss.Bff.ZaakGerichtWerken.Contactmomenten +{ + public class BronModel + { + public int Id { get; set; } + + public string ContactmomentDetailsId { get; set; } = default!; + + public string Soort { get; set; } = string.Empty; + + public string Titel { get; set; } = string.Empty; + + public string Url { get; set; } = string.Empty; + + public ContactmomentDetailsModel ContactmomentDetails { get; set; } = null!; + } +} diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs index e0e5628b..ce6fcd31 100644 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs +++ b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs @@ -15,5 +15,7 @@ public class ContactmomentDetailsModel public string? SpecifiekeVraag { get; set; } public string? EmailadresKcm { get; set; } public string? VerantwoordelijkeAfdeling { get; set; } + + public List Bronnen { get; set; } = new (); } } diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs index 5468f339..ba8f9f1d 100644 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs +++ b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs @@ -18,7 +18,9 @@ public ContactmomentDetailsToevoegen(BeheerDbContext db) public async Task Post(ContactmomentDetailsModel model, CancellationToken cancellationToken) { model.EmailadresKcm = User.GetEmail(); - var existingModel = await _db.ContactMomentDetails.FindAsync(model.Id); + var existingModel = await _db.ContactMomentDetails + .Include(c => c.Bronnen) + .FirstOrDefaultAsync(c => c.Id == model.Id, cancellationToken); if (existingModel == null) { @@ -27,6 +29,30 @@ public async Task Post(ContactmomentDetailsModel model, Cancellat else { _db.Entry(existingModel).CurrentValues.SetValues(model); + + var existingBronIds = existingModel.Bronnen.Select(b => b.Id).ToList(); + var incomingBronIds = model.Bronnen.Select(b => b.Id).ToList(); + + var bronnenToDelete = existingModel.Bronnen + .Where(b => !incomingBronIds.Contains(b.Id)) + .ToList(); + + _db.Bronnen.RemoveRange(bronnenToDelete); + + foreach (var incomingBron in model.Bronnen) + { + var existingBron = existingModel.Bronnen + .FirstOrDefault(b => b.Id == incomingBron.Id); + + if (existingBron != null) + { + _db.Entry(existingBron).CurrentValues.SetValues(incomingBron); + } + else + { + existingModel.Bronnen.Add(incomingBron); + } + } } await _db.SaveChangesAsync(cancellationToken); diff --git a/Kiss.Bff/Intern/Data/BeheerDbContext.cs b/Kiss.Bff/Intern/Data/BeheerDbContext.cs index 844b95a5..0744bfc3 100644 --- a/Kiss.Bff/Intern/Data/BeheerDbContext.cs +++ b/Kiss.Bff/Intern/Data/BeheerDbContext.cs @@ -46,6 +46,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { l.HasIndex(x => x.Vraag); l.HasIndex(x => x.VerantwoordelijkeAfdeling); + + l.HasMany(c => c.Bronnen) + .WithOne(b => b.ContactmomentDetails) + .HasForeignKey(b => b.ContactmomentDetailsId) + .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity() @@ -67,6 +72,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public DbSet DataProtectionKeys { get; set; } = null!; public DbSet VerwerkingsLogs { get; set; } = null!; public DbSet ContactMomentDetails { get; set; } = null!; + public DbSet Bronnen { get; set; } = null!; public DbSet ContactVerzoekVragenSets { get; set; } = null!; public DbSet Kanalen { get; set; } = null!; } diff --git a/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs b/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs new file mode 100644 index 00000000..6b93783a --- /dev/null +++ b/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs @@ -0,0 +1,395 @@ +// +using System; +using Kiss.Bff.Beheer.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Kiss.Bff.NieuwsEnWerkinstructies.Migrations +{ + [DbContext(typeof(BeheerDbContext))] + [Migration("20241031100726_AddBronModel")] + partial class AddBronModel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.29") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("BerichtSkill", b => + { + b.Property("BerichtenId") + .HasColumnType("integer"); + + b.Property("SkillsId") + .HasColumnType("integer"); + + b.HasKey("BerichtenId", "SkillsId"); + + b.HasIndex("SkillsId"); + + b.ToTable("BerichtSkill"); + }); + + modelBuilder.Entity("Kiss.Bff.Beheer.Gespreksresultaten.Data.Entities.Gespreksresultaat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("Definitie") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Definitie") + .IsUnique(); + + b.ToTable("Gespreksresultaten"); + }); + + modelBuilder.Entity("Kiss.Bff.Beheer.Links.Data.Entities.Link", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Categorie") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Links"); + }); + + modelBuilder.Entity("Kiss.Bff.Beheer.Verwerking.VerwerkingsLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApiEndpoint") + .IsRequired() + .HasColumnType("text"); + + b.Property("InsertedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("NOW()"); + + b.Property("Method") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("VerwerkingsLogs"); + }); + + modelBuilder.Entity("Kiss.Bff.Intern.Kanalen.Data.Entities.Kanaal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("Naam") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Naam") + .IsUnique(); + + b.ToTable("Kanalen"); + }); + + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("Inhoud") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsBelangrijk") + .HasColumnType("boolean"); + + b.Property("PublicatieDatum") + .HasColumnType("timestamp with time zone"); + + b.Property("PublicatieEinddatum") + .HasColumnType("timestamp with time zone"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("Type"); + + b.ToTable("Berichten"); + }); + + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.BerichtGelezen", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("BerichtId") + .HasColumnType("integer"); + + b.Property("GelezenOp") + .HasColumnType("timestamp with time zone"); + + b.HasKey("UserId", "BerichtId"); + + b.HasIndex("BerichtId"); + + b.ToTable("Gelezen"); + }); + + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Naam") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Skills"); + }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactmomentDetailsId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Soort") + .IsRequired() + .HasColumnType("text"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ContactmomentDetailsId"); + + b.ToTable("Bronnen"); + }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Einddatum") + .HasColumnType("timestamp with time zone"); + + b.Property("EmailadresKcm") + .HasColumnType("text"); + + b.Property("Gespreksresultaat") + .HasColumnType("text"); + + b.Property("SpecifiekeVraag") + .HasColumnType("text"); + + b.Property("Startdatum") + .HasColumnType("timestamp with time zone"); + + b.Property("VerantwoordelijkeAfdeling") + .HasColumnType("text"); + + b.Property("Vraag") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("VerantwoordelijkeAfdeling"); + + b.HasIndex("Vraag"); + + b.ToTable("ContactMomentDetails"); + }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactverzoeken.ContactVerzoekVragenSet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AfdelingId") + .IsRequired() + .HasColumnType("text"); + + b.Property("AfdelingNaam") + .IsRequired() + .HasColumnType("text"); + + b.Property("JsonVragen") + .HasColumnType("json"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ContactVerzoekVragenSets"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("BerichtSkill", b => + { + b.HasOne("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", null) + .WithMany() + .HasForeignKey("BerichtenId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Skill", null) + .WithMany() + .HasForeignKey("SkillsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.BerichtGelezen", b => + { + b.HasOne("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", null) + .WithMany("Gelezen") + .HasForeignKey("BerichtId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => + { + b.HasOne("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", "ContactmomentDetails") + .WithMany("Bronnen") + .HasForeignKey("ContactmomentDetailsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactmomentDetails"); + }); + + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", b => + { + b.Navigation("Gelezen"); + }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => + { + b.Navigation("Bronnen"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs b/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs new file mode 100644 index 00000000..bf9df89a --- /dev/null +++ b/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs @@ -0,0 +1,46 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Kiss.Bff.NieuwsEnWerkinstructies.Migrations +{ + public partial class AddBronModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Bronnen", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ContactmomentDetailsId = table.Column(type: "text", nullable: false), + Soort = table.Column(type: "text", nullable: false), + Titel = table.Column(type: "text", nullable: false), + Url = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Bronnen", x => x.Id); + table.ForeignKey( + name: "FK_Bronnen_ContactMomentDetails_ContactmomentDetailsId", + column: x => x.ContactmomentDetailsId, + principalTable: "ContactMomentDetails", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Bronnen_ContactmomentDetailsId", + table: "Bronnen", + column: "ContactmomentDetailsId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Bronnen"); + } + } +} diff --git a/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs b/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs index aebb7fef..b542d2ed 100644 --- a/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs +++ b/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.16") + .HasAnnotation("ProductVersion", "6.0.29") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -230,7 +230,38 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Skills"); }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetails", b => + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactmomentDetailsId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Soort") + .IsRequired() + .HasColumnType("text"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ContactmomentDetailsId"); + + b.ToTable("Bronnen"); + }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => { b.Property("Id") .HasColumnType("text"); @@ -336,10 +367,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => + { + b.HasOne("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", "ContactmomentDetails") + .WithMany("Bronnen") + .HasForeignKey("ContactmomentDetailsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactmomentDetails"); + }); + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", b => { b.Navigation("Gelezen"); }); + + modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => + { + b.Navigation("Bronnen"); + }); #pragma warning restore 612, 618 } } From 4b32227be1d3ca421ea3a322d493b585b53745af Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Mon, 4 Nov 2024 13:52:19 +0100 Subject: [PATCH 02/10] wip --- Kiss.Bff.Test/AuthorizationCheckTests.cs | 2 +- Kiss.Bff.Test/GetFaqTests.cs | 6 +- .../ReadContactmomentenDetailsTests.cs | 9 +-- .../ContactmomentDetailsDetails.cs | 36 ----------- .../ContactmomentDetailsToevoegen.cs | 63 ------------------- .../Data/Entities/ContactmomentDetails.cs} | 6 +- .../Entities/ContactmomentDetailsBron.cs} | 9 +-- .../Features/ContactMomentDetailsModel.cs | 6 ++ .../Features/ContactmomentDetailsDetails.cs | 50 +++++++++++++++ ...ContactmomentDetailsRapportageOverzicht.cs | 30 +++++---- .../Features/ContactmomentDetailsToevoegen.cs | 52 +++++++++++++++ Kiss.Bff/Intern/Data/BeheerDbContext.cs | 8 +-- .../ContactmomentAfhandeling.vue | 59 +++++++++++++++-- .../write-contactmoment-details.ts | 8 ++- 14 files changed, 208 insertions(+), 136 deletions(-) delete mode 100644 Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsDetails.cs delete mode 100644 Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs rename Kiss.Bff/{Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs => Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs} (75%) rename Kiss.Bff/{Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs => Intern/ContactmomentDetails/Data/Entities/ContactmomentDetailsBron.cs} (53%) create mode 100644 Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs create mode 100644 Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs rename Kiss.Bff/{Extern/ZaakGerichtWerken/Contactmomenten => Intern/ContactmomentDetails/Features}/ContactmomentDetailsRapportageOverzicht.cs (71%) create mode 100644 Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs diff --git a/Kiss.Bff.Test/AuthorizationCheckTests.cs b/Kiss.Bff.Test/AuthorizationCheckTests.cs index d8fb0bfa..a35ef8fc 100644 --- a/Kiss.Bff.Test/AuthorizationCheckTests.cs +++ b/Kiss.Bff.Test/AuthorizationCheckTests.cs @@ -15,7 +15,7 @@ using Kiss.Bff.Beheer.Verwerking; using Kiss.Bff.Intern.Links.Features; using Kiss.Bff.Intern.Gespreksresultaten.Features; -using Kiss.Bff.Extern.ZaakGerichtWerken.Contactmomenten; +using Kiss.Bff.Intern.ContactmomentDetails.Features; namespace Kiss.Bff.Test { diff --git a/Kiss.Bff.Test/GetFaqTests.cs b/Kiss.Bff.Test/GetFaqTests.cs index cdb00848..39a75e2d 100644 --- a/Kiss.Bff.Test/GetFaqTests.cs +++ b/Kiss.Bff.Test/GetFaqTests.cs @@ -1,6 +1,6 @@ using Kiss.Bff.Beheer.Data; using Kiss.Bff.Beheer.Faq; -using Kiss.Bff.ZaakGerichtWerken.Contactmomenten; +using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; @@ -31,13 +31,13 @@ public async Task Get_ReturnsTopQuestions() // Arrange var controller = new GetFaq(dbContext); - var testData = new List(); + var testData = new List(); var topQuestionsCount = 10; // Add 500 questions for (int i = 1; i <= 500; i++) { - testData.Add(new ContactmomentDetailsModel + testData.Add(new ContactmomentDetails { Id = i.ToString(), Vraag = $"Question {i}", diff --git a/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs b/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs index c6c17bc3..19c438e7 100644 --- a/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs +++ b/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs @@ -2,7 +2,8 @@ using System.Linq.Expressions; using System.Security.Claims; using Kiss.Bff.Beheer.Data; -using Kiss.Bff.ZaakGerichtWerken.Contactmomenten; +using Kiss.Bff.Intern.ContactmomentDetails; +using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -43,7 +44,7 @@ public void Cleanup() private void SeedTestData() { using var dbContext = new BeheerDbContext(_dbContextOptions); - var contactmoment1 = new ContactmomentDetailsModel + var contactmoment1 = new ContactmomentDetails { Id = "1", Startdatum = DateTime.Now, @@ -52,7 +53,7 @@ private void SeedTestData() Vraag = "Question 1" }; - var contactmoment2 = new ContactmomentDetailsModel + var contactmoment2 = new ContactmomentDetails { Id = "2", Startdatum = DateTime.Now, @@ -80,7 +81,7 @@ public async Task Get_ValidId_ReturnsOk() Assert.IsNotNull(result); Assert.AreEqual(200, result.StatusCode); - var contactmoment = result.Value as ContactmomentDetailsModel; + var contactmoment = result.Value as ContactmomentDetails; Assert.IsNotNull(contactmoment); Assert.AreEqual(validId, contactmoment.Id); } diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsDetails.cs b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsDetails.cs deleted file mode 100644 index 910d6fcb..00000000 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsDetails.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Globalization; -using Kiss.Bff.Beheer.Data; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; - -namespace Kiss.Bff.ZaakGerichtWerken.Contactmomenten -{ - [ApiController] - public class ReadContactmomentDetails : ControllerBase - { - private readonly BeheerDbContext _db; - private const int MaxPageSize = 5000; - - public ReadContactmomentDetails(BeheerDbContext db) - { - _db = db; - } - - [HttpGet("/api/contactmomentdetails")] - public async Task Get([FromQuery] string id, CancellationToken token) - { - var contactmoment = await _db.ContactMomentDetails - .FirstOrDefaultAsync(x => x.Id == id); - - if (contactmoment == null) - { - return NotFound(); - } - - return Ok(contactmoment); - } - - - } -} diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs b/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs deleted file mode 100644 index ba8f9f1d..00000000 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsToevoegen.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Kiss.Bff.Beheer.Data; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; - -namespace Kiss.Bff.ZaakGerichtWerken.Contactmomenten -{ - [ApiController] - public class ContactmomentDetailsToevoegen : ControllerBase - { - private readonly BeheerDbContext _db; - - public ContactmomentDetailsToevoegen(BeheerDbContext db) - { - _db = db; - } - - [HttpPut("/api/contactmomentdetails")] - public async Task Post(ContactmomentDetailsModel model, CancellationToken cancellationToken) - { - model.EmailadresKcm = User.GetEmail(); - var existingModel = await _db.ContactMomentDetails - .Include(c => c.Bronnen) - .FirstOrDefaultAsync(c => c.Id == model.Id, cancellationToken); - - if (existingModel == null) - { - await _db.AddAsync(model, cancellationToken); - } - else - { - _db.Entry(existingModel).CurrentValues.SetValues(model); - - var existingBronIds = existingModel.Bronnen.Select(b => b.Id).ToList(); - var incomingBronIds = model.Bronnen.Select(b => b.Id).ToList(); - - var bronnenToDelete = existingModel.Bronnen - .Where(b => !incomingBronIds.Contains(b.Id)) - .ToList(); - - _db.Bronnen.RemoveRange(bronnenToDelete); - - foreach (var incomingBron in model.Bronnen) - { - var existingBron = existingModel.Bronnen - .FirstOrDefault(b => b.Id == incomingBron.Id); - - if (existingBron != null) - { - _db.Entry(existingBron).CurrentValues.SetValues(incomingBron); - } - else - { - existingModel.Bronnen.Add(incomingBron); - } - } - } - - await _db.SaveChangesAsync(cancellationToken); - - return Ok(); - } - } -} diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs similarity index 75% rename from Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs rename to Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs index ce6fcd31..3e82fa48 100644 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsModel.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -namespace Kiss.Bff.ZaakGerichtWerken.Contactmomenten +namespace Kiss.Bff.Intern.ContactmomentDetails.Data.Entities { - public class ContactmomentDetailsModel + public class ContactmomentDetails { [Required] public string Id { get; set; } = default!; @@ -16,6 +16,6 @@ public class ContactmomentDetailsModel public string? EmailadresKcm { get; set; } public string? VerantwoordelijkeAfdeling { get; set; } - public List Bronnen { get; set; } = new (); + public List Bronnen { get; set; } = new(); } } diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetailsBron.cs similarity index 53% rename from Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs rename to Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetailsBron.cs index 07fa6a36..b2dd80d6 100644 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/BronModel.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetailsBron.cs @@ -1,9 +1,6 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Kiss.Bff.ZaakGerichtWerken.Contactmomenten +namespace Kiss.Bff.Intern.ContactmomentDetails.Data.Entities { - public class BronModel + public class ContactmomentDetailsBron { public int Id { get; set; } @@ -15,6 +12,6 @@ public class BronModel public string Url { get; set; } = string.Empty; - public ContactmomentDetailsModel ContactmomentDetails { get; set; } = null!; + public ContactmomentDetails ContactmomentDetails { get; set; } = null!; } } diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs new file mode 100644 index 00000000..83c5b906 --- /dev/null +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs @@ -0,0 +1,6 @@ +namespace Kiss.Bff.Intern.ContactmomentDetails.Features +{ + public record ContactmomentDetailsModel(string Id, DateTimeOffset Einddatum, string? EmailadresKcm, string? Gespreksresultaat, string? SpecifiekeVraag, DateTimeOffset Startdatum, string? VerantwoordelijkeAfdeling, string? Vraag, IEnumerable Bronnen); + public record BronModel(string Soort, string Titel, string Url); + +} diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs new file mode 100644 index 00000000..14b1e43c --- /dev/null +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs @@ -0,0 +1,50 @@ +using Kiss.Bff.Beheer.Data; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace Kiss.Bff.Intern.ContactmomentDetails.Features +{ + [ApiController] + public class ReadContactmomentDetails : ControllerBase + { + private readonly BeheerDbContext _db; + private const int MaxPageSize = 5000; + + public ReadContactmomentDetails(BeheerDbContext db) + { + _db = db; + } + + [HttpGet("/api/contactmomentdetails")] + public async Task Get([FromQuery] string id, CancellationToken token) + { + var contactmoment = await _db.ContactMomentDetails + .Where(x => x.Id == id) + .Select(x => new ContactmomentDetailsModel( + x.Id, + x.Einddatum, + x.EmailadresKcm, + x.Gespreksresultaat, + x.SpecifiekeVraag, + x.Startdatum, + x.VerantwoordelijkeAfdeling, + x.Vraag, + x.Bronnen.Select(b => new BronModel( + b.Soort, + b.Titel, + b.Url + )) + )) + .AsSplitQuery() + .FirstOrDefaultAsync(token); + + if (contactmoment == null) + { + return NotFound(); + } + + return Ok(contactmoment); + } + } + +} diff --git a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsRapportageOverzicht.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs similarity index 71% rename from Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsRapportageOverzicht.cs rename to Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs index 7df387f7..7e8baef8 100644 --- a/Kiss.Bff/Extern/ZaakGerichtWerken/Contactmomenten/ContactmomentDetailsRapportageOverzicht.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs @@ -1,12 +1,11 @@ -using Kiss.Bff.Beheer.Data; +using System.Globalization; +using Kiss.Bff.Beheer.Data; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System.Globalization; using Microsoft.EntityFrameworkCore; -namespace Kiss.Bff.Extern.ZaakGerichtWerken.Contactmomenten +namespace Kiss.Bff.Intern.ContactmomentDetails.Features { - [ApiController] public class ContactmomentDetailsRapportageOverzicht : ControllerBase { @@ -27,8 +26,8 @@ public async Task Get( [FromQuery] int pageSize = 5000, [FromQuery] int page = 1) { - if (!DateTime.TryParseExact(from, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out DateTime fromDate) || - !DateTime.TryParseExact(to, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out DateTime toDate)) + if (!DateTime.TryParseExact(from, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out var fromDate) || + !DateTime.TryParseExact(to, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out var toDate)) { return BadRequest("Invalid date format. Use ISO 8601 format (yyyy-MM-ddTHH:mm:ssZ)."); } @@ -43,6 +42,20 @@ public async Task Get( .OrderByDescending(x => x.Startdatum) .Skip((page - 1) * pageSize) .Take(pageSize) + .Select(x => new ContactmomentDetailsModel( + x.Id, + x.Einddatum, + x.EmailadresKcm, + x.Gespreksresultaat, + x.SpecifiekeVraag, + x.Startdatum, + x.VerantwoordelijkeAfdeling, + x.Vraag, + x.Bronnen.Select(b => new BronModel( + b.Soort, + b.Titel, + b.Url)) + )) .ToListAsync(token); return Ok(contactmomenten); @@ -50,8 +63,3 @@ public async Task Get( } } - - - - - diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs new file mode 100644 index 00000000..b3aa3678 --- /dev/null +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs @@ -0,0 +1,52 @@ +using Kiss.Bff.Beheer.Data; +using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace Kiss.Bff.Intern.ContactmomentDetails.Features +{ + [ApiController] + public class ContactmomentDetailsToevoegen : ControllerBase + { + private readonly BeheerDbContext _db; + + public ContactmomentDetailsToevoegen(BeheerDbContext db) + { + _db = db; + } + + [HttpPut("/api/contactmomentdetails")] + public async Task Post(ContactmomentDetailsModel model, CancellationToken cancellationToken) + { + var entity = await _db.ContactMomentDetails.Include(x => x.Bronnen).FirstOrDefaultAsync(x => x.Id == model.Id, cancellationToken: cancellationToken); + + if(entity == null) + { + entity = new Data.Entities.ContactmomentDetails + { + Id = model.Id, + Einddatum = model.Einddatum, + EmailadresKcm = User.GetEmail(), + Gespreksresultaat = model.Gespreksresultaat, + SpecifiekeVraag = model.SpecifiekeVraag, + Startdatum = model.Startdatum, + VerantwoordelijkeAfdeling = model.VerantwoordelijkeAfdeling, + Vraag = model.Vraag, + Bronnen = new List() + }; + await _db.AddAsync(entity, cancellationToken); + } + + entity.Bronnen.Clear(); + + foreach (var bron in model.Bronnen.Select(b => new ContactmomentDetailsBron { Soort = b.Soort, Titel = b.Titel, Url = b.Url })) + { + entity.Bronnen.Add(bron); + } + + await _db.SaveChangesAsync(cancellationToken); + + return Ok(); + } + } +} diff --git a/Kiss.Bff/Intern/Data/BeheerDbContext.cs b/Kiss.Bff/Intern/Data/BeheerDbContext.cs index 0744bfc3..1606894d 100644 --- a/Kiss.Bff/Intern/Data/BeheerDbContext.cs +++ b/Kiss.Bff/Intern/Data/BeheerDbContext.cs @@ -1,9 +1,9 @@ using Kiss.Bff.Beheer.Gespreksresultaten.Data.Entities; using Kiss.Bff.Beheer.Links.Data.Entities; using Kiss.Bff.Beheer.Verwerking; +using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; using Kiss.Bff.Intern.Kanalen.Data.Entities; using Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities; -using Kiss.Bff.ZaakGerichtWerken.Contactmomenten; using Kiss.Bff.ZaakGerichtWerken.Contactverzoeken; using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -42,7 +42,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity(r => r.Property(l => l.InsertedAt).HasDefaultValueSql("NOW()").ValueGeneratedOnAdd()); - modelBuilder.Entity(l => + modelBuilder.Entity(l => { l.HasIndex(x => x.Vraag); l.HasIndex(x => x.VerantwoordelijkeAfdeling); @@ -71,8 +71,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public DbSet Gespreksresultaten { get; set; } = null!; public DbSet DataProtectionKeys { get; set; } = null!; public DbSet VerwerkingsLogs { get; set; } = null!; - public DbSet ContactMomentDetails { get; set; } = null!; - public DbSet Bronnen { get; set; } = null!; + public DbSet ContactMomentDetails { get; set; } = null!; + public DbSet Bronnen { get; set; } = null!; public DbSet ContactVerzoekVragenSets { get; set; } = null!; public DbSet Kanalen { get; set; } = null!; } diff --git a/src/features/contact/contactmoment/ContactmomentAfhandeling.vue b/src/features/contact/contactmoment/ContactmomentAfhandeling.vue index 1ffeafab..01685350 100644 --- a/src/features/contact/contactmoment/ContactmomentAfhandeling.vue +++ b/src/features/contact/contactmoment/ContactmomentAfhandeling.vue @@ -424,7 +424,11 @@ import { } from "@utrecht/component-library-vue"; import SimpleSpinner from "@/components/SimpleSpinner.vue"; import ApplicationMessage from "@/components/ApplicationMessage.vue"; -import { useContactmomentStore, type Vraag } from "@/stores/contactmoment"; +import { + useContactmomentStore, + type Bron, + type Vraag, +} from "@/stores/contactmoment"; import { toast } from "@/stores/toast"; import { koppelKlant, @@ -456,7 +460,10 @@ import { useOrganisatieIds, useUserStore } from "@/stores/user"; import { useConfirmDialog } from "@vueuse/core"; import PromptModal from "@/components/PromptModal.vue"; import { nanoid } from "nanoid"; -import { writeContactmomentDetails } from "@/features/contact/contactmoment/write-contactmoment-details"; +import { + writeContactmomentDetails, + type ContactmomentDetails, +} from "@/features/contact/contactmoment/write-contactmoment-details"; import BackLink from "@/components/BackLink.vue"; import AfdelingenSearch from "@/features/contact/components/AfdelingenSearch.vue"; import { fetchAfdelingen } from "@/features/contact/components/afdelingen"; @@ -609,6 +616,50 @@ const saveVraag = async (vraag: Vraag, gespreksId?: string) => { Object.assign(contactmoment, contactverzoekData); } + const fullUrl = (url: string) => + url.startsWith("http") ? url : new URL(url, location.origin).toString(); + + const cmDetails: ContactmomentDetails = { + ...contactmoment, + bronnen: [ + ...vraag.kennisartikelen + .filter(({ shouldStore }) => shouldStore) + .map(({ kennisartikel: { title, url } }) => ({ + url: fullUrl(url), + titel: title, + soort: "kennisartikel", + })), + ...vraag.werkinstructies + .filter(({ shouldStore }) => shouldStore) + .map(({ werkinstructie: { title, url } }) => ({ + url: fullUrl(url), + titel: title, + soort: "werkinstructie", + })), + ...vraag.vacs + .filter(({ shouldStore }) => shouldStore) + .map(({ vac: { title, url } }) => ({ + url: fullUrl(url), + titel: title, + soort: "vac", + })), + ...vraag.nieuwsberichten + .filter(({ shouldStore }) => shouldStore) + .map(({ nieuwsbericht: { title, url } }) => ({ + url: fullUrl(url), + titel: title, + soort: "nieuwsbericht", + })), + ...vraag.websites + .filter(({ shouldStore }) => shouldStore) + .map(({ website: { title, url } }) => ({ + url: fullUrl(url), + titel: title, + soort: "website", + })), + ], + }; + // Openklant2 flow if (useKlantInteractiesApi) { // 1. klantcontact opslaan @@ -636,7 +687,7 @@ const saveVraag = async (vraag: Vraag, gespreksId?: string) => { // 2 ////////////////////// await writeContactmomentDetails( - contactmoment, + cmDetails, savedKlantContactResult.data?.url, ); @@ -758,7 +809,7 @@ const saveVraag = async (vraag: Vraag, gespreksId?: string) => { const savedContactmoment = savedContactmomentResult.data; const promises = [ - writeContactmomentDetails(contactmoment, savedContactmoment.url), + writeContactmomentDetails(cmDetails, savedContactmoment.url), zakenToevoegenAanContactmoment(vraag, savedContactmoment.url), ]; diff --git a/src/features/contact/contactmoment/write-contactmoment-details.ts b/src/features/contact/contactmoment/write-contactmoment-details.ts index 0d5431d7..41efafbf 100644 --- a/src/features/contact/contactmoment/write-contactmoment-details.ts +++ b/src/features/contact/contactmoment/write-contactmoment-details.ts @@ -9,7 +9,13 @@ export type ContactmomentDetails = Pick< | "vraag" | "specifiekevraag" | "verantwoordelijkeAfdeling" ->; +> & { + bronnen: { + url: string; + soort: string; + titel: string; + }[]; +}; export const writeContactmomentDetails = ( contactmoment: ContactmomentDetails, From d229684cc37f00e3b4ec48d39a6ca1e7ab8482b8 Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Mon, 4 Nov 2024 14:56:57 +0100 Subject: [PATCH 03/10] wip --- .../Data/Entities/ContactmomentDetails.cs | 3 -- .../Features/ContactMomentDetailsModel.cs | 42 +++++++++++++++++-- .../Features/ContactmomentDetailsBronModel.cs | 14 +++++++ .../Features/ContactmomentDetailsDetails.cs | 17 +------- ...ContactmomentDetailsRapportageOverzicht.cs | 15 +------ 5 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsBronModel.cs diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs b/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs index 3e82fa48..dd3356ad 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Data/Entities/ContactmomentDetails.cs @@ -4,11 +4,8 @@ namespace Kiss.Bff.Intern.ContactmomentDetails.Data.Entities { public class ContactmomentDetails { - [Required] public string Id { get; set; } = default!; - [Required] public DateTimeOffset Startdatum { get; set; } - [Required] public DateTimeOffset Einddatum { get; set; } public string? Gespreksresultaat { get; set; } public string? Vraag { get; set; } diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs index 83c5b906..548feda3 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs @@ -1,6 +1,42 @@ -namespace Kiss.Bff.Intern.ContactmomentDetails.Features +using System.ComponentModel.DataAnnotations; + +namespace Kiss.Bff.Intern.ContactmomentDetails.Features { - public record ContactmomentDetailsModel(string Id, DateTimeOffset Einddatum, string? EmailadresKcm, string? Gespreksresultaat, string? SpecifiekeVraag, DateTimeOffset Startdatum, string? VerantwoordelijkeAfdeling, string? Vraag, IEnumerable Bronnen); - public record BronModel(string Soort, string Titel, string Url); + public class ContactmomentDetailsModel + { + [Required] + public string Id { get; set; } = default!; + [Required] + public DateTimeOffset Startdatum { get; set; } + [Required] + public DateTimeOffset Einddatum { get; set; } + public string? Gespreksresultaat { get; set; } + public string? Vraag { get; set; } + public string? SpecifiekeVraag { get; set; } + public string? EmailadresKcm { get; set; } + public string? VerantwoordelijkeAfdeling { get; set; } + + public IEnumerable Bronnen { get; set; } = Enumerable.Empty(); + } + internal static class ContactmomentDetailsModelExtensions + { + public static IQueryable ToModel(this IQueryable queryable) => queryable.Select(x => new ContactmomentDetailsModel + { + Id = x.Id, + Einddatum = x.Einddatum, + EmailadresKcm = x.EmailadresKcm, + Gespreksresultaat = x.Gespreksresultaat, + SpecifiekeVraag = x.SpecifiekeVraag, + Startdatum = x.Startdatum, + VerantwoordelijkeAfdeling = x.VerantwoordelijkeAfdeling, + Vraag = x.Vraag, + Bronnen = x.Bronnen.Select(b => new ContactmomentDetailsBronModel + { + Soort = b.Soort, + Titel = b.Titel, + Url = b.Url + }) + }); + } } diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsBronModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsBronModel.cs new file mode 100644 index 00000000..2e615ea5 --- /dev/null +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsBronModel.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace Kiss.Bff.Intern.ContactmomentDetails.Features +{ + public class ContactmomentDetailsBronModel + { + [Required] + public string Soort { get; set; } = ""; + [Required] + public string Titel { get; set; } = ""; + [Required] + public string Url { get; set; } = ""; + } +} diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs index 14b1e43c..9b783bed 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs @@ -8,7 +8,6 @@ namespace Kiss.Bff.Intern.ContactmomentDetails.Features public class ReadContactmomentDetails : ControllerBase { private readonly BeheerDbContext _db; - private const int MaxPageSize = 5000; public ReadContactmomentDetails(BeheerDbContext db) { @@ -20,21 +19,7 @@ public async Task Get([FromQuery] string id, CancellationToken to { var contactmoment = await _db.ContactMomentDetails .Where(x => x.Id == id) - .Select(x => new ContactmomentDetailsModel( - x.Id, - x.Einddatum, - x.EmailadresKcm, - x.Gespreksresultaat, - x.SpecifiekeVraag, - x.Startdatum, - x.VerantwoordelijkeAfdeling, - x.Vraag, - x.Bronnen.Select(b => new BronModel( - b.Soort, - b.Titel, - b.Url - )) - )) + .ToModel() .AsSplitQuery() .FirstOrDefaultAsync(token); diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs index 7e8baef8..c702b31c 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs @@ -42,20 +42,7 @@ public async Task Get( .OrderByDescending(x => x.Startdatum) .Skip((page - 1) * pageSize) .Take(pageSize) - .Select(x => new ContactmomentDetailsModel( - x.Id, - x.Einddatum, - x.EmailadresKcm, - x.Gespreksresultaat, - x.SpecifiekeVraag, - x.Startdatum, - x.VerantwoordelijkeAfdeling, - x.Vraag, - x.Bronnen.Select(b => new BronModel( - b.Soort, - b.Titel, - b.Url)) - )) + .ToModel() .ToListAsync(token); return Ok(contactmomenten); From a68ea96d24d0be7febf51d361c82e8cddc9b997f Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Tue, 5 Nov 2024 10:00:08 +0100 Subject: [PATCH 04/10] cleanup --- .../Features/ContactmomentDetailsToevoegen.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs index b3aa3678..29cdfda4 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs @@ -1,4 +1,5 @@ using Kiss.Bff.Beheer.Data; +using Kiss.Bff.Beheer.Gespreksresultaten.Data.Entities; using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -25,19 +26,19 @@ public async Task Post(ContactmomentDetailsModel model, Cancellat entity = new Data.Entities.ContactmomentDetails { Id = model.Id, - Einddatum = model.Einddatum, - EmailadresKcm = User.GetEmail(), - Gespreksresultaat = model.Gespreksresultaat, - SpecifiekeVraag = model.SpecifiekeVraag, - Startdatum = model.Startdatum, - VerantwoordelijkeAfdeling = model.VerantwoordelijkeAfdeling, - Vraag = model.Vraag, Bronnen = new List() }; await _db.AddAsync(entity, cancellationToken); } entity.Bronnen.Clear(); + entity.Einddatum = model.Einddatum; + entity.EmailadresKcm = User.GetEmail(); + entity.Gespreksresultaat = model.Gespreksresultaat; + entity.SpecifiekeVraag = model.SpecifiekeVraag; + entity.Startdatum = model.Startdatum; + entity.VerantwoordelijkeAfdeling = model.VerantwoordelijkeAfdeling; + entity.Vraag = model.Vraag; foreach (var bron in model.Bronnen.Select(b => new ContactmomentDetailsBron { Soort = b.Soort, Titel = b.Titel, Url = b.Url })) { From 74d8460c6b2fca19c263c5f20686f5457dc4097f Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Tue, 5 Nov 2024 10:01:36 +0100 Subject: [PATCH 05/10] cleanup --- .../Features/ContactmomentDetailsToevoegen.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs index 29cdfda4..89164102 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsToevoegen.cs @@ -1,5 +1,4 @@ using Kiss.Bff.Beheer.Data; -using Kiss.Bff.Beheer.Gespreksresultaten.Data.Entities; using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -21,7 +20,7 @@ public async Task Post(ContactmomentDetailsModel model, Cancellat { var entity = await _db.ContactMomentDetails.Include(x => x.Bronnen).FirstOrDefaultAsync(x => x.Id == model.Id, cancellationToken: cancellationToken); - if(entity == null) + if (entity == null) { entity = new Data.Entities.ContactmomentDetails { @@ -40,9 +39,14 @@ public async Task Post(ContactmomentDetailsModel model, Cancellat entity.VerantwoordelijkeAfdeling = model.VerantwoordelijkeAfdeling; entity.Vraag = model.Vraag; - foreach (var bron in model.Bronnen.Select(b => new ContactmomentDetailsBron { Soort = b.Soort, Titel = b.Titel, Url = b.Url })) + foreach (var b in model.Bronnen) { - entity.Bronnen.Add(bron); + entity.Bronnen.Add(new ContactmomentDetailsBron + { + Soort = b.Soort, + Titel = b.Titel, + Url = b.Url + }); } await _db.SaveChangesAsync(cancellationToken); From 741145555ff839a659fafa787ee43599edf06a3f Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Tue, 5 Nov 2024 12:08:41 +0100 Subject: [PATCH 06/10] fix tests --- .../ReadContactmomentenDetailsTests.cs | 24 ++------- .../WriteContactmomentDetailsTests.cs | 35 +++++++++---- Kiss.Bff.Test/ZaakGerichtWerkenUnitTests.cs | 52 ------------------- 3 files changed, 28 insertions(+), 83 deletions(-) diff --git a/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs b/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs index 19c438e7..4e46eeb6 100644 --- a/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs +++ b/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs @@ -1,36 +1,18 @@ -using System; -using System.Linq.Expressions; -using System.Security.Claims; -using Kiss.Bff.Beheer.Data; -using Kiss.Bff.Intern.ContactmomentDetails; +using Kiss.Bff.Beheer.Data; using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; +using Kiss.Bff.Intern.ContactmomentDetails.Features; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; namespace Kiss.Bff.Test { [TestClass] public class ReadContactmomentenDetailsTests : TestHelper { - private IServiceProvider? _serviceProvider; - [TestInitialize] public void Initialize() { InitializeDatabase(); SeedTestData(); - - var services = new ServiceCollection(); - var user = new ClaimsPrincipal(new ClaimsIdentity(new[] - { - new Claim(ClaimTypes.NameIdentifier, "testuser"), - new Claim(ClaimTypes.Role, Policies.RedactiePolicy) - })); - services.AddSingleton(_ => new HttpContextAccessor { HttpContext = new DefaultHttpContext { User = user } }); - _serviceProvider = services.BuildServiceProvider(); } [TestCleanup] @@ -81,7 +63,7 @@ public async Task Get_ValidId_ReturnsOk() Assert.IsNotNull(result); Assert.AreEqual(200, result.StatusCode); - var contactmoment = result.Value as ContactmomentDetails; + var contactmoment = result.Value as ContactmomentDetailsModel; Assert.IsNotNull(contactmoment); Assert.AreEqual(validId, contactmoment.Id); } diff --git a/Kiss.Bff.Test/WriteContactmomentDetailsTests.cs b/Kiss.Bff.Test/WriteContactmomentDetailsTests.cs index 1aeb97d0..71e1cd9d 100644 --- a/Kiss.Bff.Test/WriteContactmomentDetailsTests.cs +++ b/Kiss.Bff.Test/WriteContactmomentDetailsTests.cs @@ -1,8 +1,9 @@ using Kiss.Bff.Beheer.Data; -using Kiss.Bff.ZaakGerichtWerken.Contactmomenten; +using Kiss.Bff.Intern.ContactmomentDetails.Features; +using ContactmomentDetails = Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; +using Kiss.Bff.Intern.ContactmomentDetails.Data.Entities; namespace Kiss.Bff.Test { @@ -36,7 +37,8 @@ public async Task Post_ValidModel_ReturnsOk() Einddatum = DateTime.Now.AddHours(1), Gespreksresultaat = "Result 1", Vraag = "Question 1", - EmailadresKcm = "test@example.com" // User.GetEmail() + EmailadresKcm = "test@example.com", // User.GetEmail() + Bronnen = new[] {new ContactmomentDetailsBronModel { Soort = "Soort", Titel = "Titel", Url = "Url" } } }; // Act @@ -47,9 +49,12 @@ public async Task Post_ValidModel_ReturnsOk() //Assert.AreEqual(200, result.StatusCode); // Check if the model is added to the database - var addedModel = await dbContext.ContactMomentDetails.FirstOrDefaultAsync(); - Assert.IsNotNull(addedModel); - Assert.AreEqual(validModel.Id, addedModel.Id); + var addedEntity = await dbContext.ContactMomentDetails.Include(x=> x.Bronnen).FirstOrDefaultAsync(); + var addedBron = addedEntity?.Bronnen.FirstOrDefault(); + Assert.IsNotNull(addedEntity); + Assert.IsNotNull(addedBron); + Assert.AreEqual(validModel.Id, addedEntity.Id); + Assert.AreEqual(validModel.Bronnen.First().Titel, addedBron.Titel); } @@ -58,14 +63,20 @@ public async Task Post_ModelWithExistingId_UpdatesExistingEntity() { // Arrange using var dbContext = new BeheerDbContext(_dbContextOptions); - var existingEntity = new ContactmomentDetailsModel + var existingEntity = new ContactmomentDetails { Id = "1", Startdatum = DateTime.Now, Einddatum = DateTime.Now.AddHours(1), Gespreksresultaat = "Result 1", Vraag = "Question 1", - EmailadresKcm = "test@example.com" + EmailadresKcm = "test@example.com", + Bronnen = new List { new ContactmomentDetailsBron + { + Titel = "Titel1", + Soort = "Soort1", + Url = "Url1" + } } }; dbContext.ContactMomentDetails.Add(existingEntity); dbContext.SaveChanges(); @@ -78,7 +89,8 @@ public async Task Post_ModelWithExistingId_UpdatesExistingEntity() Einddatum = DateTime.Now.AddHours(1), Gespreksresultaat = "Result 2", Vraag = "Question 2", - EmailadresKcm = "test@example.com" + EmailadresKcm = "test@example.com", + Bronnen = new[] {new ContactmomentDetailsBronModel { Soort = "Soort2", Url = "Url2", Titel = "Titel2" } } }; // Act @@ -89,9 +101,12 @@ public async Task Post_ModelWithExistingId_UpdatesExistingEntity() Assert.AreEqual(200, result.StatusCode); // Check if the entity was updated in the database - var updatedEntity = await dbContext.ContactMomentDetails.FindAsync(model.Id); + var updatedEntity = await dbContext.ContactMomentDetails.Include(x=> x.Bronnen).FirstOrDefaultAsync(x=> x.Id == model.Id); + var updatedBron = updatedEntity?.Bronnen?.FirstOrDefault(); Assert.IsNotNull(updatedEntity); + Assert.IsNotNull(updatedBron); Assert.AreEqual(model.Gespreksresultaat, updatedEntity.Gespreksresultaat); + Assert.AreEqual(model.Bronnen.First().Titel, updatedBron.Titel); } } } diff --git a/Kiss.Bff.Test/ZaakGerichtWerkenUnitTests.cs b/Kiss.Bff.Test/ZaakGerichtWerkenUnitTests.cs index bba14094..443c6697 100644 --- a/Kiss.Bff.Test/ZaakGerichtWerkenUnitTests.cs +++ b/Kiss.Bff.Test/ZaakGerichtWerkenUnitTests.cs @@ -1,13 +1,7 @@ using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Text; -using Kiss.Bff.Beheer.Data; -using Kiss.Bff.ZaakGerichtWerken; -using Kiss.Bff.ZaakGerichtWerken.Contactmomenten; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; -using Moq; namespace Kiss.Bff.Test { @@ -86,51 +80,5 @@ public void GenerateToken_ReturnsValidToken() var principal = tokenHandler.ValidateToken(token, validationParameters, out _); Assert.IsNotNull(principal); } - - [TestMethod] - public async Task Post_AddsOrUpdatesContactmomentToDatabase() - { - // Arrange - var cancellationToken = CancellationToken.None; - var model = new ContactmomentDetailsModel - { - Id = "1", - Startdatum = DateTimeOffset.Now, - Einddatum = DateTimeOffset.Now.AddDays(1), - Gespreksresultaat = "Success", - Vraag = "Question", - SpecifiekeVraag = "Topic", - EmailadresKcm = "test@example.com" - }; - var dbContextMock = new Mock(_dbContextOptions) { CallBase = true }; - dbContextMock.Setup(db => db.SaveChangesAsync(cancellationToken)).Returns(Task.FromResult(1)); - - var userClaims = new[] - { - new Claim(ClaimTypes.Email, "test@example.com") - }; - var user = new ClaimsPrincipal(new ClaimsIdentity(userClaims)); - var controller = new ContactmomentDetailsToevoegen(dbContextMock.Object) - { - ControllerContext = new ControllerContext - { - HttpContext = new DefaultHttpContext - { - User = user - } - } - }; - - - // Act - var result = await controller.Post(model, cancellationToken); - - // Assert - dbContextMock.Verify(db => db.AddAsync(model, cancellationToken), Times.Once); - dbContextMock.Verify(db => db.SaveChangesAsync(cancellationToken), Times.Once); - Assert.IsInstanceOfType(result, typeof(OkResult)); - } - - } } From ecfe2df41d151381ab14830a7cebe055c28627d3 Mon Sep 17 00:00:00 2001 From: githubjimmeicatt Date: Wed, 6 Nov 2024 14:43:58 +0100 Subject: [PATCH 07/10] rename table bronnen to contactmomentdetailsbronnen --- Kiss.Bff/Intern/Data/BeheerDbContext.cs | 2 +- ...ddContactMomentDetailsBronnen.Designer.cs} | 162 +++++++++--------- ...6133641_AddContactMomentDetailsBronnen.cs} | 44 ++++- .../BeheerDbContextModelSnapshot.cs | 158 ++++++++--------- 4 files changed, 198 insertions(+), 168 deletions(-) rename Kiss.Bff/Intern/Data/Migrations/{20241031100726_AddBronModel.Designer.cs => 20241106133641_AddContactMomentDetailsBronnen.Designer.cs} (94%) rename Kiss.Bff/Intern/Data/Migrations/{20241031100726_AddBronModel.cs => 20241106133641_AddContactMomentDetailsBronnen.cs} (52%) diff --git a/Kiss.Bff/Intern/Data/BeheerDbContext.cs b/Kiss.Bff/Intern/Data/BeheerDbContext.cs index 1606894d..3d203793 100644 --- a/Kiss.Bff/Intern/Data/BeheerDbContext.cs +++ b/Kiss.Bff/Intern/Data/BeheerDbContext.cs @@ -72,7 +72,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public DbSet DataProtectionKeys { get; set; } = null!; public DbSet VerwerkingsLogs { get; set; } = null!; public DbSet ContactMomentDetails { get; set; } = null!; - public DbSet Bronnen { get; set; } = null!; + public DbSet ContactMomentDetailsBronnen { get; set; } = null!; public DbSet ContactVerzoekVragenSets { get; set; } = null!; public DbSet Kanalen { get; set; } = null!; } diff --git a/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs b/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.Designer.cs similarity index 94% rename from Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs rename to Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.Designer.cs index 6b93783a..25ebe135 100644 --- a/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.Designer.cs +++ b/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.Designer.cs @@ -12,8 +12,8 @@ namespace Kiss.Bff.NieuwsEnWerkinstructies.Migrations { [DbContext(typeof(BeheerDbContext))] - [Migration("20241031100726_AddBronModel")] - partial class AddBronModel + [Migration("20241106133641_AddContactMomentDetailsBronnen")] + partial class AddContactMomentDetailsBronnen { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -121,6 +121,72 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("VerwerkingsLogs"); }); + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Einddatum") + .HasColumnType("timestamp with time zone"); + + b.Property("EmailadresKcm") + .HasColumnType("text"); + + b.Property("Gespreksresultaat") + .HasColumnType("text"); + + b.Property("SpecifiekeVraag") + .HasColumnType("text"); + + b.Property("Startdatum") + .HasColumnType("timestamp with time zone"); + + b.Property("VerantwoordelijkeAfdeling") + .HasColumnType("text"); + + b.Property("Vraag") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("VerantwoordelijkeAfdeling"); + + b.HasIndex("Vraag"); + + b.ToTable("ContactMomentDetails"); + }); + + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetailsBron", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactmomentDetailsId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Soort") + .IsRequired() + .HasColumnType("text"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ContactmomentDetailsId"); + + b.ToTable("ContactMomentDetailsBronnen"); + }); + modelBuilder.Entity("Kiss.Bff.Intern.Kanalen.Data.Entities.Kanaal", b => { b.Property("Id") @@ -232,72 +298,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("Skills"); }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ContactmomentDetailsId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Soort") - .IsRequired() - .HasColumnType("text"); - - b.Property("Titel") - .IsRequired() - .HasColumnType("text"); - - b.Property("Url") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ContactmomentDetailsId"); - - b.ToTable("Bronnen"); - }); - - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Einddatum") - .HasColumnType("timestamp with time zone"); - - b.Property("EmailadresKcm") - .HasColumnType("text"); - - b.Property("Gespreksresultaat") - .HasColumnType("text"); - - b.Property("SpecifiekeVraag") - .HasColumnType("text"); - - b.Property("Startdatum") - .HasColumnType("timestamp with time zone"); - - b.Property("VerantwoordelijkeAfdeling") - .HasColumnType("text"); - - b.Property("Vraag") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("VerantwoordelijkeAfdeling"); - - b.HasIndex("Vraag"); - - b.ToTable("ContactMomentDetails"); - }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactverzoeken.ContactVerzoekVragenSet", b => { b.Property("Id") @@ -360,6 +360,17 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetailsBron", b => + { + b.HasOne("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails", "ContactmomentDetails") + .WithMany("Bronnen") + .HasForeignKey("ContactmomentDetailsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactmomentDetails"); + }); + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.BerichtGelezen", b => { b.HasOne("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", null) @@ -369,26 +380,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired(); }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails", b => { - b.HasOne("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", "ContactmomentDetails") - .WithMany("Bronnen") - .HasForeignKey("ContactmomentDetailsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactmomentDetails"); + b.Navigation("Bronnen"); }); modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", b => { b.Navigation("Gelezen"); }); - - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => - { - b.Navigation("Bronnen"); - }); #pragma warning restore 612, 618 } } diff --git a/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs b/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs similarity index 52% rename from Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs rename to Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs index bf9df89a..3ad3e225 100644 --- a/Kiss.Bff/Intern/Data/Migrations/20241031100726_AddBronModel.cs +++ b/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs @@ -5,12 +5,15 @@ namespace Kiss.Bff.NieuwsEnWerkinstructies.Migrations { - public partial class AddBronModel : Migration + public partial class AddContactMomentDetailsBronnen : Migration { protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "Bronnen"); + migrationBuilder.CreateTable( - name: "Bronnen", + name: "ContactMomentDetailsBronnen", columns: table => new { Id = table.Column(type: "integer", nullable: false) @@ -22,9 +25,9 @@ protected override void Up(MigrationBuilder migrationBuilder) }, constraints: table => { - table.PrimaryKey("PK_Bronnen", x => x.Id); + table.PrimaryKey("PK_ContactMomentDetailsBronnen", x => x.Id); table.ForeignKey( - name: "FK_Bronnen_ContactMomentDetails_ContactmomentDetailsId", + name: "FK_ContactMomentDetailsBronnen_ContactMomentDetails_Contactmom~", column: x => x.ContactmomentDetailsId, principalTable: "ContactMomentDetails", principalColumn: "Id", @@ -32,15 +35,42 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateIndex( - name: "IX_Bronnen_ContactmomentDetailsId", - table: "Bronnen", + name: "IX_ContactMomentDetailsBronnen_ContactmomentDetailsId", + table: "ContactMomentDetailsBronnen", column: "ContactmomentDetailsId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "Bronnen"); + name: "ContactMomentDetailsBronnen"); + + migrationBuilder.CreateTable( + name: "Bronnen", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ContactmomentDetailsId = table.Column(type: "text", nullable: false), + Soort = table.Column(type: "text", nullable: false), + Titel = table.Column(type: "text", nullable: false), + Url = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Bronnen", x => x.Id); + table.ForeignKey( + name: "FK_Bronnen_ContactMomentDetails_ContactmomentDetailsId", + column: x => x.ContactmomentDetailsId, + principalTable: "ContactMomentDetails", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Bronnen_ContactmomentDetailsId", + table: "Bronnen", + column: "ContactmomentDetailsId"); } } } diff --git a/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs b/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs index b542d2ed..987ae8f8 100644 --- a/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs +++ b/Kiss.Bff/Intern/Data/Migrations/BeheerDbContextModelSnapshot.cs @@ -119,6 +119,72 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("VerwerkingsLogs"); }); + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Einddatum") + .HasColumnType("timestamp with time zone"); + + b.Property("EmailadresKcm") + .HasColumnType("text"); + + b.Property("Gespreksresultaat") + .HasColumnType("text"); + + b.Property("SpecifiekeVraag") + .HasColumnType("text"); + + b.Property("Startdatum") + .HasColumnType("timestamp with time zone"); + + b.Property("VerantwoordelijkeAfdeling") + .HasColumnType("text"); + + b.Property("Vraag") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("VerantwoordelijkeAfdeling"); + + b.HasIndex("Vraag"); + + b.ToTable("ContactMomentDetails"); + }); + + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetailsBron", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactmomentDetailsId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Soort") + .IsRequired() + .HasColumnType("text"); + + b.Property("Titel") + .IsRequired() + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ContactmomentDetailsId"); + + b.ToTable("ContactMomentDetailsBronnen"); + }); + modelBuilder.Entity("Kiss.Bff.Intern.Kanalen.Data.Entities.Kanaal", b => { b.Property("Id") @@ -230,72 +296,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Skills"); }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ContactmomentDetailsId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Soort") - .IsRequired() - .HasColumnType("text"); - - b.Property("Titel") - .IsRequired() - .HasColumnType("text"); - - b.Property("Url") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ContactmomentDetailsId"); - - b.ToTable("Bronnen"); - }); - - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Einddatum") - .HasColumnType("timestamp with time zone"); - - b.Property("EmailadresKcm") - .HasColumnType("text"); - - b.Property("Gespreksresultaat") - .HasColumnType("text"); - - b.Property("SpecifiekeVraag") - .HasColumnType("text"); - - b.Property("Startdatum") - .HasColumnType("timestamp with time zone"); - - b.Property("VerantwoordelijkeAfdeling") - .HasColumnType("text"); - - b.Property("Vraag") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("VerantwoordelijkeAfdeling"); - - b.HasIndex("Vraag"); - - b.ToTable("ContactMomentDetails"); - }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactverzoeken.ContactVerzoekVragenSet", b => { b.Property("Id") @@ -358,6 +358,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetailsBron", b => + { + b.HasOne("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails", "ContactmomentDetails") + .WithMany("Bronnen") + .HasForeignKey("ContactmomentDetailsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactmomentDetails"); + }); + modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.BerichtGelezen", b => { b.HasOne("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", null) @@ -367,26 +378,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.BronModel", b => + modelBuilder.Entity("Kiss.Bff.Intern.ContactmomentDetails.Data.Entities.ContactmomentDetails", b => { - b.HasOne("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", "ContactmomentDetails") - .WithMany("Bronnen") - .HasForeignKey("ContactmomentDetailsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ContactmomentDetails"); + b.Navigation("Bronnen"); }); modelBuilder.Entity("Kiss.Bff.NieuwsEnWerkinstructies.Data.Entities.Bericht", b => { b.Navigation("Gelezen"); }); - - modelBuilder.Entity("Kiss.Bff.ZaakGerichtWerken.Contactmomenten.ContactmomentDetailsModel", b => - { - b.Navigation("Bronnen"); - }); #pragma warning restore 612, 618 } } From 2b3e0e0b4f8deb5deb1adab6d9209cc9c93b191d Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Thu, 7 Nov 2024 16:34:30 +0100 Subject: [PATCH 08/10] fix test --- ...06133641_AddContactMomentDetailsBronnen.cs | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs b/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs index 3ad3e225..c5626f1e 100644 --- a/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs +++ b/Kiss.Bff/Intern/Data/Migrations/20241106133641_AddContactMomentDetailsBronnen.cs @@ -9,9 +9,6 @@ public partial class AddContactMomentDetailsBronnen : Migration { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.DropTable( - name: "Bronnen"); - migrationBuilder.CreateTable( name: "ContactMomentDetailsBronnen", columns: table => new @@ -44,33 +41,6 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ContactMomentDetailsBronnen"); - - migrationBuilder.CreateTable( - name: "Bronnen", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ContactmomentDetailsId = table.Column(type: "text", nullable: false), - Soort = table.Column(type: "text", nullable: false), - Titel = table.Column(type: "text", nullable: false), - Url = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Bronnen", x => x.Id); - table.ForeignKey( - name: "FK_Bronnen_ContactMomentDetails_ContactmomentDetailsId", - column: x => x.ContactmomentDetailsId, - principalTable: "ContactMomentDetails", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Bronnen_ContactmomentDetailsId", - table: "Bronnen", - column: "ContactmomentDetailsId"); } } } From 6091bbac9d185698f46a2cbb01f8b6ee25c416c4 Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Thu, 7 Nov 2024 16:34:43 +0100 Subject: [PATCH 09/10] feedback --- .../ReadContactmomentenDetailsTests.cs | 2 +- .../Features/ContactMomentDetailsModel.cs | 21 ------------------- .../ContactmomentDetailsDetailModel.cs | 14 +++++++++++++ .../Features/ContactmomentDetailsDetails.cs | 13 ++++++++++-- ...ContactmomentDetailsRapportageOverzicht.cs | 18 +++++++++++++++- 5 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetailModel.cs diff --git a/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs b/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs index 4e46eeb6..c18e5deb 100644 --- a/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs +++ b/Kiss.Bff.Test/ReadContactmomentenDetailsTests.cs @@ -63,7 +63,7 @@ public async Task Get_ValidId_ReturnsOk() Assert.IsNotNull(result); Assert.AreEqual(200, result.StatusCode); - var contactmoment = result.Value as ContactmomentDetailsModel; + var contactmoment = result.Value as ContactmomentDetailsDetailModel; Assert.IsNotNull(contactmoment); Assert.AreEqual(validId, contactmoment.Id); } diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs index 548feda3..e6304f0f 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactMomentDetailsModel.cs @@ -18,25 +18,4 @@ public class ContactmomentDetailsModel public IEnumerable Bronnen { get; set; } = Enumerable.Empty(); } - - internal static class ContactmomentDetailsModelExtensions - { - public static IQueryable ToModel(this IQueryable queryable) => queryable.Select(x => new ContactmomentDetailsModel - { - Id = x.Id, - Einddatum = x.Einddatum, - EmailadresKcm = x.EmailadresKcm, - Gespreksresultaat = x.Gespreksresultaat, - SpecifiekeVraag = x.SpecifiekeVraag, - Startdatum = x.Startdatum, - VerantwoordelijkeAfdeling = x.VerantwoordelijkeAfdeling, - Vraag = x.Vraag, - Bronnen = x.Bronnen.Select(b => new ContactmomentDetailsBronModel - { - Soort = b.Soort, - Titel = b.Titel, - Url = b.Url - }) - }); - } } diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetailModel.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetailModel.cs new file mode 100644 index 00000000..8229120c --- /dev/null +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetailModel.cs @@ -0,0 +1,14 @@ +namespace Kiss.Bff.Intern.ContactmomentDetails.Features +{ + public class ContactmomentDetailsDetailModel + { + public string Id { get; set; } = default!; + public DateTimeOffset Startdatum { get; set; } + public DateTimeOffset Einddatum { get; set; } + public string? Gespreksresultaat { get; set; } + public string? Vraag { get; set; } + public string? SpecifiekeVraag { get; set; } + public string? EmailadresKcm { get; set; } + public string? VerantwoordelijkeAfdeling { get; set; } + } +} diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs index 9b783bed..ef7106ce 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsDetails.cs @@ -19,8 +19,17 @@ public async Task Get([FromQuery] string id, CancellationToken to { var contactmoment = await _db.ContactMomentDetails .Where(x => x.Id == id) - .ToModel() - .AsSplitQuery() + .Select(x => new ContactmomentDetailsDetailModel + { + Id = x.Id, + Einddatum = x.Einddatum, + EmailadresKcm = x.EmailadresKcm, + Gespreksresultaat = x.Gespreksresultaat, + SpecifiekeVraag = x.SpecifiekeVraag, + Startdatum = x.Startdatum, + VerantwoordelijkeAfdeling = x.VerantwoordelijkeAfdeling, + Vraag = x.Vraag + }) .FirstOrDefaultAsync(token); if (contactmoment == null) diff --git a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs index c702b31c..1fcc1b7b 100644 --- a/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs +++ b/Kiss.Bff/Intern/ContactmomentDetails/Features/ContactmomentDetailsRapportageOverzicht.cs @@ -42,7 +42,23 @@ public async Task Get( .OrderByDescending(x => x.Startdatum) .Skip((page - 1) * pageSize) .Take(pageSize) - .ToModel() + .Select(x => new ContactmomentDetailsModel + { + Id = x.Id, + Einddatum = x.Einddatum, + EmailadresKcm = x.EmailadresKcm, + Gespreksresultaat = x.Gespreksresultaat, + SpecifiekeVraag = x.SpecifiekeVraag, + Startdatum = x.Startdatum, + VerantwoordelijkeAfdeling = x.VerantwoordelijkeAfdeling, + Vraag = x.Vraag, + Bronnen = x.Bronnen.Select(b => new ContactmomentDetailsBronModel + { + Soort = b.Soort, + Titel = b.Titel, + Url = b.Url + }) + }) .ToListAsync(token); return Ok(contactmomenten); From 2a9bcf05d13dcc46ae7bdbded38711e687673a63 Mon Sep 17 00:00:00 2001 From: mark stoker Date: Fri, 8 Nov 2024 11:29:20 +0100 Subject: [PATCH 10/10] unrelated typo --- .../nieuws-en-werkinstructies/NieuwsEnWerkinstructieBeheer.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Beheer/nieuws-en-werkinstructies/NieuwsEnWerkinstructieBeheer.vue b/src/views/Beheer/nieuws-en-werkinstructies/NieuwsEnWerkinstructieBeheer.vue index d174932f..1aedf68f 100644 --- a/src/views/Beheer/nieuws-en-werkinstructies/NieuwsEnWerkinstructieBeheer.vue +++ b/src/views/Beheer/nieuws-en-werkinstructies/NieuwsEnWerkinstructieBeheer.vue @@ -246,7 +246,7 @@ async function load() { bericht.value = initBericht(); } - //load skils + //load skills const skillsResponse = await fetchLoggedIn("/api/Skills"); if (skillsResponse.status > 300) {