From 35709e3d64dffb5797253022798339a8baaf1436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Wed, 8 Jan 2025 14:51:29 +0100 Subject: [PATCH 1/7] Make delivery attributes optional & configurable in mandate --- ...ableOptionalDeliveryAttributes.Designer.cs | 305 ++++++++++++++++++ ...141508_EnableOptionalDeliveryAttributes.cs | 110 +++++++ .../Migrations/ContextModelSnapshot.cs | 17 +- src/Geopilot.Api/Models/Delivery.cs | 2 +- .../Models/FieldEvaluationType.cs | 23 ++ src/Geopilot.Api/Models/Mandate.cs | 18 ++ 6 files changed, 471 insertions(+), 4 deletions(-) create mode 100644 src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs create mode 100644 src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs create mode 100644 src/Geopilot.Api/Models/FieldEvaluationType.cs diff --git a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs new file mode 100644 index 00000000..c6609986 --- /dev/null +++ b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs @@ -0,0 +1,305 @@ +// +using System; +using Geopilot.Api; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NetTopologySuite.Geometries; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Geopilot.Api.Migrations +{ + [DbContext(typeof(Context))] + [Migration("20250107141508_EnableOptionalDeliveryAttributes")] + partial class EnableOptionalDeliveryAttributes + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Geopilot.Api.Models.Asset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AssetType") + .IsRequired() + .HasColumnType("varchar(24)"); + + b.Property("Deleted") + .HasColumnType("boolean"); + + b.Property("DeliveryId") + .HasColumnType("integer"); + + b.Property("FileHash") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("OriginalFilename") + .IsRequired() + .HasColumnType("text"); + + b.Property("SanitizedFilename") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeliveryId"); + + b.ToTable("Assets"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Delivery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("DeclaringUserId") + .HasColumnType("integer"); + + b.Property("Deleted") + .HasColumnType("boolean"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("MandateId") + .HasColumnType("integer"); + + b.Property("Partial") + .HasColumnType("boolean"); + + b.Property("PrecursorDeliveryId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DeclaringUserId"); + + b.HasIndex("MandateId"); + + b.HasIndex("PrecursorDeliveryId"); + + b.ToTable("Deliveries"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Mandate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EvaluateComment") + .IsRequired() + .HasColumnType("varchar(24)"); + + b.Property("EvaluatePartial") + .IsRequired() + .HasColumnType("varchar(24)"); + + b.Property("EvaluatePrecursorDelivery") + .IsRequired() + .HasColumnType("varchar(24)"); + + b.Property("FileTypes") + .IsRequired() + .HasColumnType("text[]"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SpatialExtent") + .IsRequired() + .HasColumnType("geometry"); + + b.HasKey("Id"); + + b.ToTable("Mandates"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Organisation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Organisations"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthIdentifier") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsAdmin") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("MandateOrganisation", b => + { + b.Property("MandatesId") + .HasColumnType("integer"); + + b.Property("OrganisationsId") + .HasColumnType("integer"); + + b.HasKey("MandatesId", "OrganisationsId"); + + b.HasIndex("OrganisationsId"); + + b.ToTable("MandateOrganisation"); + }); + + modelBuilder.Entity("OrganisationUser", b => + { + b.Property("OrganisationsId") + .HasColumnType("integer"); + + b.Property("UsersId") + .HasColumnType("integer"); + + b.HasKey("OrganisationsId", "UsersId"); + + b.HasIndex("UsersId"); + + b.ToTable("OrganisationUser"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Asset", b => + { + b.HasOne("Geopilot.Api.Models.Delivery", "Delivery") + .WithMany("Assets") + .HasForeignKey("DeliveryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Delivery"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Delivery", b => + { + b.HasOne("Geopilot.Api.Models.User", "DeclaringUser") + .WithMany("Deliveries") + .HasForeignKey("DeclaringUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Geopilot.Api.Models.Mandate", "Mandate") + .WithMany("Deliveries") + .HasForeignKey("MandateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Geopilot.Api.Models.Delivery", "PrecursorDelivery") + .WithMany() + .HasForeignKey("PrecursorDeliveryId"); + + b.Navigation("DeclaringUser"); + + b.Navigation("Mandate"); + + b.Navigation("PrecursorDelivery"); + }); + + modelBuilder.Entity("MandateOrganisation", b => + { + b.HasOne("Geopilot.Api.Models.Mandate", null) + .WithMany() + .HasForeignKey("MandatesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Geopilot.Api.Models.Organisation", null) + .WithMany() + .HasForeignKey("OrganisationsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("OrganisationUser", b => + { + b.HasOne("Geopilot.Api.Models.Organisation", null) + .WithMany() + .HasForeignKey("OrganisationsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Geopilot.Api.Models.User", null) + .WithMany() + .HasForeignKey("UsersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Delivery", b => + { + b.Navigation("Assets"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.Mandate", b => + { + b.Navigation("Deliveries"); + }); + + modelBuilder.Entity("Geopilot.Api.Models.User", b => + { + b.Navigation("Deliveries"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs new file mode 100644 index 00000000..9362c65b --- /dev/null +++ b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs @@ -0,0 +1,110 @@ +using Geopilot.Api.Models; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Geopilot.Api.Migrations +{ + /// + public partial class EnableOptionalDeliveryAttributes : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EvaluateComment", + table: "Mandates", + type: "varchar(24)", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "EvaluatePartial", + table: "Mandates", + type: "varchar(24)", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "EvaluatePrecursorDelivery", + table: "Mandates", + type: "varchar(24)", + nullable: false, + defaultValue: ""); + + migrationBuilder.AlterColumn( + name: "Partial", + table: "Deliveries", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "Comment", + table: "Deliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.UpdateData( + table: "Mandates", + keyColumn: "EvaluateComment", + keyValue: string.Empty, + column: "EvaluateComment", + value: FieldEvaluationType.Required.ToString()); + + migrationBuilder.UpdateData( + table: "Mandates", + keyColumn: "EvaluatePartial", + keyValue: string.Empty, + column: "EvaluatePartial", + value: FieldEvaluationType.Required.ToString()); + + migrationBuilder.UpdateData( + table: "Mandates", + keyColumn: "EvaluatePrecursorDelivery", + keyValue: string.Empty, + column: "EvaluatePrecursorDelivery", + value: FieldEvaluationType.Required.ToString()); + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EvaluateComment", + table: "Mandates"); + + migrationBuilder.DropColumn( + name: "EvaluatePartial", + table: "Mandates"); + + migrationBuilder.DropColumn( + name: "EvaluatePrecursorDelivery", + table: "Mandates"); + + migrationBuilder.AlterColumn( + name: "Partial", + table: "Deliveries", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Comment", + table: "Deliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + } + } +} diff --git a/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs b/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs index b72df553..74414488 100644 --- a/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs +++ b/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs @@ -18,7 +18,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); @@ -70,7 +70,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Comment") - .IsRequired() .HasColumnType("text"); b.Property("Date") @@ -88,7 +87,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("MandateId") .HasColumnType("integer"); - b.Property("Partial") + b.Property("Partial") .HasColumnType("boolean"); b.Property("PrecursorDeliveryId") @@ -113,6 +112,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("EvaluateComment") + .IsRequired() + .HasColumnType("varchar(24)"); + + b.Property("EvaluatePartial") + .IsRequired() + .HasColumnType("varchar(24)"); + + b.Property("EvaluatePrecursorDelivery") + .IsRequired() + .HasColumnType("varchar(24)"); + b.Property("FileTypes") .IsRequired() .HasColumnType("text[]"); diff --git a/src/Geopilot.Api/Models/Delivery.cs b/src/Geopilot.Api/Models/Delivery.cs index 1ef33617..69b5e9b9 100644 --- a/src/Geopilot.Api/Models/Delivery.cs +++ b/src/Geopilot.Api/Models/Delivery.cs @@ -38,7 +38,7 @@ public class Delivery /// /// Indicate whether the delivery contains partial data. /// - public bool Partial { get; set; } + public bool? Partial { get; set; } /// /// The previous delivery on the same . diff --git a/src/Geopilot.Api/Models/FieldEvaluationType.cs b/src/Geopilot.Api/Models/FieldEvaluationType.cs new file mode 100644 index 00000000..a2f17abf --- /dev/null +++ b/src/Geopilot.Api/Models/FieldEvaluationType.cs @@ -0,0 +1,23 @@ +namespace Geopilot.Api.Models +{ + /// + /// Defines how fileds have to be evaluated. + /// + public enum FieldEvaluationType + { + /// + /// Field must not contain any value. + /// + NotEvaluated, + + /// + /// Field may contain a value but must not. + /// + Optional, + + /// + /// Field must contan a value. + /// + Required, + } +} diff --git a/src/Geopilot.Api/Models/Mandate.cs b/src/Geopilot.Api/Models/Mandate.cs index 582dbfdf..f1e2495c 100644 --- a/src/Geopilot.Api/Models/Mandate.cs +++ b/src/Geopilot.Api/Models/Mandate.cs @@ -40,6 +40,24 @@ public class Mandate [NotMapped] public List Coordinates { get; set; } = new List(); + /// + /// Defines how is evaluated. + /// + [Column(TypeName = "varchar(24)")] + public FieldEvaluationType EvaluatePrecursorDelivery { get; set; } + + /// + /// Defines how is evaluated. + /// + [Column(TypeName = "varchar(24)")] + public FieldEvaluationType EvaluatePartial { get; set; } + + /// + /// Defines how is evaluated. + /// + [Column(TypeName = "varchar(24)")] + public FieldEvaluationType EvaluateComment { get; set; } + /// /// Organisations allowed to deliver data fulfilling the mandate. /// From af06542d5b00b21e6b79292a45e627164930c8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Wed, 8 Jan 2025 14:51:54 +0100 Subject: [PATCH 2/7] Handle nullable fields in STAC conversion --- src/Geopilot.Api/StacServices/StacConverter.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Geopilot.Api/StacServices/StacConverter.cs b/src/Geopilot.Api/StacServices/StacConverter.cs index 24facb74..f3da0968 100644 --- a/src/Geopilot.Api/StacServices/StacConverter.cs +++ b/src/Geopilot.Api/StacServices/StacConverter.cs @@ -112,7 +112,11 @@ public StacItem ToStacItem(Delivery delivery) DateTime = new TimeBlock(delivery.Date), }; - item.Properties.Add("Teillieferung", delivery.Partial ? "Ja" : "Nein"); + if (delivery.Partial.HasValue) + { + item.Properties.Add("Teillieferung", delivery.Partial.Value ? "Ja" : "Nein"); + } + item.Properties.Add("Abgegeben durch", delivery.DeclaringUser.FullName); if (delivery.PrecursorDelivery != null) { From 4862f42ac92cc836ae2e7aa865022f6c7504c65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Wed, 8 Jan 2025 14:52:07 +0100 Subject: [PATCH 3/7] Randomly seed Evaluate... on mandate --- src/Geopilot.Api/ContextExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Geopilot.Api/ContextExtensions.cs b/src/Geopilot.Api/ContextExtensions.cs index 5d435b6d..c427502e 100644 --- a/src/Geopilot.Api/ContextExtensions.cs +++ b/src/Geopilot.Api/ContextExtensions.cs @@ -118,6 +118,9 @@ public static void SeedMandates(this Context context) .RuleFor(o => o.Id, f => 0) .RuleFor(o => o.Name, f => f.Commerce.ProductName()) .RuleFor(o => o.FileTypes, f => f.PickRandom(knownFileFormats, 4).Distinct().ToArray()) + .RuleFor(o => o.EvaluatePrecursorDelivery, f => f.PickRandom()) + .RuleFor(o => o.EvaluatePartial, f => f.PickRandom()) + .RuleFor(o => o.EvaluateComment, f => f.PickRandom()) .RuleFor(o => o.SpatialExtent, f => GetExtent()) .Ignore(o => o.Coordinates) .RuleFor(o => o.Organisations, f => f.PickRandom(context.Organisations.ToList(), 1).ToList()) From 23e7132f5e05e1a56305cce93dd4c4aea46a2c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Thu, 9 Jan 2025 14:11:53 +0100 Subject: [PATCH 4/7] Fixup not nullable Comment --- ...nableOptionalDeliveryAttributes.Designer.cs | 1 + ...7141508_EnableOptionalDeliveryAttributes.cs | 18 ------------------ .../Migrations/ContextModelSnapshot.cs | 1 + 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs index c6609986..223efae7 100644 --- a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs +++ b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs @@ -73,6 +73,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Comment") + .IsRequired() .HasColumnType("text"); b.Property("Date") diff --git a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs index 9362c65b..1a81c64e 100644 --- a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs +++ b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs @@ -40,14 +40,6 @@ protected override void Up(MigrationBuilder migrationBuilder) oldClrType: typeof(bool), oldType: "boolean"); - migrationBuilder.AlterColumn( - name: "Comment", - table: "Deliveries", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - migrationBuilder.UpdateData( table: "Mandates", keyColumn: "EvaluateComment", @@ -95,16 +87,6 @@ protected override void Down(MigrationBuilder migrationBuilder) oldClrType: typeof(bool), oldType: "boolean", oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Comment", - table: "Deliveries", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); } } } diff --git a/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs b/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs index 74414488..90725fb3 100644 --- a/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs +++ b/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs @@ -70,6 +70,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Comment") + .IsRequired() .HasColumnType("text"); b.Property("Date") From 6b77eb224aba9976d663c2574ac698ca78463427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Thu, 9 Jan 2025 12:04:10 +0100 Subject: [PATCH 5/7] Check ef migrations --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31e4e5e9..24ab03f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,10 @@ jobs: working-directory: ./src/Geopilot.Frontend run: npm run lint + - name: Check migration history + working-directory: ./src/Geopilot.Api + run: dotnet ef migrations has-pending-model-changes + - name: Start test db run: docker compose up -d --wait --wait-timeout 30 db From 2c27d1959b643d04c86d10b054de781a9315e6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Thu, 9 Jan 2025 12:10:39 +0100 Subject: [PATCH 6/7] Install ef tool --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24ab03f0..5b8aa292 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ jobs: with: dotnet-version: "8.0" + - name: Install dotnet-ef + run: dotnet tool install --global dotnet-ef + - name: Install dependencies run: dotnet restore Geopilot.sln From 227608faad2de2025230d55ce491a355d94e78e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20L=C3=BCthi?= Date: Thu, 9 Jan 2025 17:54:59 +0100 Subject: [PATCH 7/7] Use varchar(12) for FieldEvaluationType fields --- ...50107141508_EnableOptionalDeliveryAttributes.Designer.cs | 6 +++--- .../20250107141508_EnableOptionalDeliveryAttributes.cs | 6 +++--- src/Geopilot.Api/Migrations/ContextModelSnapshot.cs | 6 +++--- src/Geopilot.Api/Models/Mandate.cs | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs index 223efae7..b3f84a35 100644 --- a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs +++ b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.Designer.cs @@ -118,15 +118,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("EvaluateComment") .IsRequired() - .HasColumnType("varchar(24)"); + .HasColumnType("varchar(12)"); b.Property("EvaluatePartial") .IsRequired() - .HasColumnType("varchar(24)"); + .HasColumnType("varchar(12)"); b.Property("EvaluatePrecursorDelivery") .IsRequired() - .HasColumnType("varchar(24)"); + .HasColumnType("varchar(12)"); b.Property("FileTypes") .IsRequired() diff --git a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs index 1a81c64e..f828aeb9 100644 --- a/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs +++ b/src/Geopilot.Api/Migrations/20250107141508_EnableOptionalDeliveryAttributes.cs @@ -14,21 +14,21 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AddColumn( name: "EvaluateComment", table: "Mandates", - type: "varchar(24)", + type: "varchar(12)", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "EvaluatePartial", table: "Mandates", - type: "varchar(24)", + type: "varchar(12)", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "EvaluatePrecursorDelivery", table: "Mandates", - type: "varchar(24)", + type: "varchar(12)", nullable: false, defaultValue: ""); diff --git a/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs b/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs index 90725fb3..61cd45c8 100644 --- a/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs +++ b/src/Geopilot.Api/Migrations/ContextModelSnapshot.cs @@ -115,15 +115,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EvaluateComment") .IsRequired() - .HasColumnType("varchar(24)"); + .HasColumnType("varchar(12)"); b.Property("EvaluatePartial") .IsRequired() - .HasColumnType("varchar(24)"); + .HasColumnType("varchar(12)"); b.Property("EvaluatePrecursorDelivery") .IsRequired() - .HasColumnType("varchar(24)"); + .HasColumnType("varchar(12)"); b.Property("FileTypes") .IsRequired() diff --git a/src/Geopilot.Api/Models/Mandate.cs b/src/Geopilot.Api/Models/Mandate.cs index f1e2495c..b4d3cc03 100644 --- a/src/Geopilot.Api/Models/Mandate.cs +++ b/src/Geopilot.Api/Models/Mandate.cs @@ -43,19 +43,19 @@ public class Mandate /// /// Defines how is evaluated. /// - [Column(TypeName = "varchar(24)")] + [Column(TypeName = "varchar(12)")] public FieldEvaluationType EvaluatePrecursorDelivery { get; set; } /// /// Defines how is evaluated. /// - [Column(TypeName = "varchar(24)")] + [Column(TypeName = "varchar(12)")] public FieldEvaluationType EvaluatePartial { get; set; } /// /// Defines how is evaluated. /// - [Column(TypeName = "varchar(24)")] + [Column(TypeName = "varchar(12)")] public FieldEvaluationType EvaluateComment { get; set; } ///