Adding Flags API
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using MicCheck.Api.Organizations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace MicCheck.Api.Data.Configurations;
|
||||
|
||||
public class OrganizationConfiguration : IEntityTypeConfiguration<Organization>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Organization> builder)
|
||||
{
|
||||
builder.HasKey(o => o.Id);
|
||||
builder.Property(o => o.Name).HasMaxLength(200).IsRequired();
|
||||
builder.Property(o => o.CreatedAt).IsRequired();
|
||||
|
||||
builder.HasMany(o => o.Members)
|
||||
.WithOne()
|
||||
.HasForeignKey(ou => ou.OrganizationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasMany(o => o.ApiKeys)
|
||||
.WithOne()
|
||||
.HasForeignKey(k => k.OrganizationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasMany(o => o.Projects)
|
||||
.WithOne()
|
||||
.HasForeignKey(p => p.OrganizationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user