40 lines
1009 B
C#
40 lines
1009 B
C#
|
|
using Microsoft.EntityFrameworkCore;
|
||
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||
|
|
using WorkClub.Domain.Entities;
|
||
|
|
|
||
|
|
namespace WorkClub.Infrastructure.Data.Configurations;
|
||
|
|
|
||
|
|
public class ClubConfiguration : IEntityTypeConfiguration<Club>
|
||
|
|
{
|
||
|
|
public void Configure(EntityTypeBuilder<Club> builder)
|
||
|
|
{
|
||
|
|
builder.ToTable("clubs");
|
||
|
|
|
||
|
|
builder.HasKey(c => c.Id);
|
||
|
|
|
||
|
|
builder.Property(c => c.TenantId)
|
||
|
|
.IsRequired()
|
||
|
|
.HasMaxLength(200);
|
||
|
|
|
||
|
|
builder.Property(c => c.Name)
|
||
|
|
.IsRequired()
|
||
|
|
.HasMaxLength(200);
|
||
|
|
|
||
|
|
builder.Property(c => c.Description)
|
||
|
|
.HasMaxLength(2000);
|
||
|
|
|
||
|
|
builder.Property(c => c.SportType)
|
||
|
|
.IsRequired()
|
||
|
|
.HasConversion<int>();
|
||
|
|
|
||
|
|
builder.Property(c => c.CreatedAt)
|
||
|
|
.IsRequired();
|
||
|
|
|
||
|
|
builder.Property(c => c.UpdatedAt)
|
||
|
|
.IsRequired();
|
||
|
|
|
||
|
|
builder.HasIndex(c => c.TenantId)
|
||
|
|
.HasDatabaseName("ix_clubs_tenant_id");
|
||
|
|
}
|
||
|
|
}
|