SHA256
GuestLog - GuestDocument pages initial implementation
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Somnia.GuestLog.Models;
|
||||
|
||||
namespace Somnia.GuestLog.Infrastructure.EntityConfigs;
|
||||
|
||||
public class GuestAddressEntityConfig : IEntityTypeConfiguration<GuestAddress>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<GuestAddress> builder)
|
||||
{
|
||||
builder.HasNoKey();
|
||||
|
||||
builder.Property(e => e.Address)
|
||||
.HasMaxLength(128);
|
||||
builder.Property(e => e.AddressCity)
|
||||
.HasMaxLength(128);
|
||||
builder.Property(e => e.AddressProvince)
|
||||
.HasMaxLength(128);
|
||||
builder.Property(e => e.AddressState)
|
||||
.HasMaxLength(128);
|
||||
|
||||
//3 letter code: ISO 3166-1 Alfa-3
|
||||
builder.Property(e => e.AddressCountry)
|
||||
.IsRequired()
|
||||
.HasMaxLength(3);
|
||||
|
||||
builder.Property(e => e.ZipCode)
|
||||
.HasMaxLength(3);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Somnia.GuestLog.Models;
|
||||
using Somnia.GuestLog.Models.Entities;
|
||||
|
||||
namespace Somnia.GuestLog.Infrastructure.EntityConfigs;
|
||||
|
||||
@@ -49,12 +49,6 @@ public class GuestDocumentEntityConfig : IEntityTypeConfiguration<GuestDocument>
|
||||
.HasMaxLength(256);
|
||||
|
||||
|
||||
//Set to now on creation.
|
||||
builder.Property(e => e.CreateTime)
|
||||
.HasDefaultValueSql("current_timestamp");
|
||||
builder.Property(e => e.UpdateTime)
|
||||
.HasDefaultValueSql("current_timestamp");
|
||||
|
||||
var addressBuilder = builder.ComplexProperty(e => e.AddressDetails);
|
||||
|
||||
addressBuilder.Property(e => e.Address)
|
||||
@@ -72,6 +66,6 @@ public class GuestDocumentEntityConfig : IEntityTypeConfiguration<GuestDocument>
|
||||
.HasMaxLength(3);
|
||||
|
||||
addressBuilder.Property(e => e.ZipCode)
|
||||
.HasMaxLength(3);
|
||||
.HasMaxLength(12);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Somnia.GuestLog.Infrastructure.EntityConfigs;
|
||||
using Somnia.GuestLog.Models;
|
||||
using Somnia.GuestLog.Models.Entities;
|
||||
|
||||
namespace Somnia.GuestLog.Infrastructure;
|
||||
|
||||
|
||||
Generated
+121
@@ -0,0 +1,121 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Somnia.GuestLog.Infrastructure;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(GuestLogContext))]
|
||||
[Migration("20260621150802_GuestDocumentFixes")]
|
||||
partial class GuestDocumentFixes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||
{
|
||||
b.Property<string>("DocumentType")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("character varying(8)");
|
||||
|
||||
b.Property<string>("DocumentNum")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<DateOnly>("BirthDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EmailAddress")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("Gender")
|
||||
.HasMaxLength(1)
|
||||
.HasColumnType("character varying(1)");
|
||||
|
||||
b.Property<DateOnly>("IssueDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("Nationality")
|
||||
.IsRequired()
|
||||
.HasMaxLength(3)
|
||||
.HasColumnType("character varying(3)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("SupportNum")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("Surname2")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||
{
|
||||
b1.Property<string>("Address")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.Property<string>("AddressCity")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.Property<string>("AddressCountry")
|
||||
.IsRequired()
|
||||
.HasMaxLength(3)
|
||||
.HasColumnType("character varying(3)");
|
||||
|
||||
b1.Property<string>("AddressProvince")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.Property<string>("AddressState")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.Property<string>("ZipCode")
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("character varying(12)");
|
||||
});
|
||||
|
||||
b.HasKey("DocumentType", "DocumentNum");
|
||||
|
||||
b.ToTable("GuestDocument", (string)null);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class GuestDocumentFixes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "UpdateTime",
|
||||
table: "GuestDocument",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldDefaultValueSql: "current_timestamp");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "CreateTime",
|
||||
table: "GuestDocument",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldDefaultValueSql: "current_timestamp");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "AddressDetails_ZipCode",
|
||||
table: "GuestDocument",
|
||||
type: "character varying(12)",
|
||||
maxLength: 12,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(3)",
|
||||
oldMaxLength: 3,
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "UpdateTime",
|
||||
table: "GuestDocument",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValueSql: "current_timestamp",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "CreateTime",
|
||||
table: "GuestDocument",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValueSql: "current_timestamp",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "AddressDetails_ZipCode",
|
||||
table: "GuestDocument",
|
||||
type: "character varying(3)",
|
||||
maxLength: 3,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(12)",
|
||||
oldMaxLength: 12,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Somnia.GuestLog.Models.GuestDocument", b =>
|
||||
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||
{
|
||||
b.Property<string>("DocumentType")
|
||||
.HasMaxLength(8)
|
||||
@@ -37,9 +37,7 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("current_timestamp");
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EmailAddress")
|
||||
.HasMaxLength(256)
|
||||
@@ -80,11 +78,9 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("current_timestamp");
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||
{
|
||||
b1.Property<string>("Address")
|
||||
.HasMaxLength(128)
|
||||
@@ -108,8 +104,8 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.Property<string>("ZipCode")
|
||||
.HasMaxLength(3)
|
||||
.HasColumnType("character varying(3)");
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("character varying(12)");
|
||||
});
|
||||
|
||||
b.HasKey("DocumentType", "DocumentNum");
|
||||
|
||||
Reference in New Issue
Block a user