Files
SomniaGuestLog/src/Somnia.GuestLog/Infrastructure/EntityConfigs/StayEntryEntityConfig.cs
T
Daniel-Garmig 6dc2d2426b GuestLog - StayEntry - Initial Implementation
- Added new entity "StayEntry" to log stays of guests.
- Added pages for StayEntry management (List and creation).
- New DataList for PaymentMethods.
- Other general changes and improvements.
2026-08-15 19:33:32 +02:00

45 lines
1.3 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Somnia.GuestLog.Models.Entities;
namespace Somnia.GuestLog.Infrastructure.EntityConfigs;
public class StayEntryEntityConfig : IEntityTypeConfiguration<StayEntry>
{
public void Configure(EntityTypeBuilder<StayEntry> builder)
{
builder.ToTable("StayEntry");
//PK
builder.HasKey(e => e.Id);
builder.Property(e => e.Id)
.IsRequired()
.UseIdentityByDefaultColumn();
builder.Property(e => e.DateIn)
.IsRequired()
.HasColumnType(DbConsts.DbType_Timestamptz_0);
builder.Property(e => e.DateOut)
.IsRequired()
.HasColumnType(DbConsts.DbType_Timestamptz_0);
builder.Property(e => e.RoomNumber)
.HasMaxLength(32);
builder.Property(e => e.PaymentMethod)
.IsRequired()
.HasMaxLength(5);
builder.Property(e => e.CreateTime)
.IsRequired()
.HasColumnType(DbConsts.DbType_Timestamptz);
builder.Property(e => e.UpdateTime)
.IsRequired()
.HasColumnType(DbConsts.DbType_Timestamptz);
builder.HasMany(e => e.GuestDocuments)
.WithMany();
}
}