Added Customer, Contact and Address with Service
Labeled all service to enable assembly scanning
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Customers.Entities;
|
||||
|
||||
public class ContactConfiguration : IEntityTypeConfiguration<Contact>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Contact> builder)
|
||||
{
|
||||
builder.ToTable("Contacts");
|
||||
|
||||
builder.HasKey(c => c.Id);
|
||||
builder.Property(c => c.CustomerId).IsRequired();
|
||||
builder.Property(c => c.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
|
||||
builder.Property(c => c.UpdatedAt).HasDefaultValueSql("now()");
|
||||
builder.Property(c => c.Name).IsRequired();
|
||||
builder.Property(c => c.LastName).IsRequired();
|
||||
builder.Property(c => c.Type).IsRequired();
|
||||
builder.Property(c => c.Phone).IsRequired();
|
||||
builder.Property(c => c.Email).IsRequired();
|
||||
builder.Property(c => c.IsPrimary).HasDefaultValue(false);
|
||||
builder.Property(c => c.Enabled).HasDefaultValue(true);
|
||||
|
||||
builder.HasOne(c => c.Customer)
|
||||
.WithMany(c => c.Contacts)
|
||||
.HasForeignKey(c => c.CustomerId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user