initial commit
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class ApplicationUserConfiguration : IEntityTypeConfiguration<ApplicationUser>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ApplicationUser> builder)
|
||||
{
|
||||
builder.Property(e => e.FullName).HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
builder.Property(e => e.SsoIdFirebase).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.SsoIdKeycloak).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.SsoIdAzure).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.SsoIdAws).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.SsoIdOther1).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.SsoIdOther2).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.SsoIdOther3).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.AvatarFile).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.RefreshToken).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
|
||||
builder.Property(e => e.FirstName).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.LastName).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.ShortBio).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
builder.Property(e => e.JobTitle).HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.StreetAddress)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.City)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.StateProvince)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.ZipCode)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Country)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.SocialMediaLinkedIn)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaX)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaFacebook)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaInstagram)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaTikTok)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.OtherInformation1)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.OtherInformation2)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.OtherInformation3)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class AutoNumberSequenceConfiguration : IEntityTypeConfiguration<AutoNumberSequence>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AutoNumberSequence> builder)
|
||||
{
|
||||
|
||||
builder.Property(e => e.EntityName)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.PrefixTemplate)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.SuffixTemplate)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.HasIndex(e => new { e.EntityName, e.Year, e.Month })
|
||||
.IsUnique();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class BillConfiguration : IEntityTypeConfiguration<Bill>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Bill> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.PurchaseOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.PurchaseOrder)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.PurchaseOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.BillDate);
|
||||
builder.HasIndex(e => e.PurchaseOrderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class BookingConfiguration : IEntityTypeConfiguration<Booking>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Booking> builder)
|
||||
{
|
||||
builder.Property(e => e.Subject)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.StartTimezone)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.EndTimezone)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Location)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.RecurrenceRule)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.RecurrenceID)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.FollowingID)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.RecurrenceException)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.BookingResourceId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.BookingResource)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.BookingResourceId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.BookingResourceId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class BookingGroupConfiguration : IEntityTypeConfiguration<BookingGroup>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BookingGroup> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class BookingResourceConfiguration : IEntityTypeConfiguration<BookingResource>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BookingResource> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.BookingGroupId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.BookingGroup)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.BookingGroupId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.BookingGroupId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CompanyConfiguration : IEntityTypeConfiguration<Company>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Company> builder)
|
||||
{
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.CurrencyId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Currency)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.CurrencyId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.Property(e => e.TaxIdentification)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.BusinessLicense)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.CompanyLogo)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.StreetAddress)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.City)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.StateProvince)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.ZipCode)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Phone)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Email)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.SocialMediaLinkedIn)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaX)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaFacebook)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaInstagram)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SocialMediaTikTok)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.OtherInformation1)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.OtherInformation2)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.OtherInformation3)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.Email);
|
||||
builder.HasIndex(e => e.CurrencyId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CreditNoteConfiguration : IEntityTypeConfiguration<CreditNote>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<CreditNote> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SalesReturnId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.SalesReturn)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.SalesReturnId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.CreditNoteDate);
|
||||
builder.HasIndex(e => e.SalesReturnId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CurrencyConfiguration : IEntityTypeConfiguration<Currency>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Currency> builder)
|
||||
{
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Code)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Symbol)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.CountryOwner)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.Code).IsUnique();
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CustomerCategoryConfiguration : IEntityTypeConfiguration<CustomerCategory>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<CustomerCategory> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CustomerConfiguration : IEntityTypeConfiguration<Customer>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Customer> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.Street)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.City)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.State)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.ZipCode)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Country)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.PhoneNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.FaxNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.EmailAddress)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Website)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.WhatsApp)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.LinkedIn)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Facebook)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Instagram)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.TwitterX)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.TikTok)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.CustomerGroupId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.CustomerCategoryId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.CustomerGroup)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.CustomerGroupId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.CustomerCategory)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.CustomerCategoryId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.CustomerGroupId);
|
||||
builder.HasIndex(e => e.CustomerCategoryId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CustomerContactConfiguration : IEntityTypeConfiguration<CustomerContact>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<CustomerContact> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.JobTitle)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.PhoneNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.EmailAddress)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.CustomerId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Customer)
|
||||
.WithMany(e => e.CustomerContactList)
|
||||
.HasForeignKey(e => e.CustomerId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.CustomerId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class CustomerGroupConfiguration : IEntityTypeConfiguration<CustomerGroup>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<CustomerGroup> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class DebitNoteConfiguration : IEntityTypeConfiguration<DebitNote>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<DebitNote> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.PurchaseReturnId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.PurchaseReturn)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.PurchaseReturnId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.DebitNoteDate);
|
||||
builder.HasIndex(e => e.PurchaseReturnId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class DeliveryOrderConfiguration : IEntityTypeConfiguration<DeliveryOrder>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<DeliveryOrder> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SalesOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.SalesOrder)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.SalesOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.DeliveryDate);
|
||||
builder.HasIndex(e => e.SalesOrderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class GoodsReceiveConfiguration : IEntityTypeConfiguration<GoodsReceive>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<GoodsReceive> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.PurchaseOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.PurchaseOrder)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.PurchaseOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.ReceiveDate);
|
||||
builder.HasIndex(e => e.PurchaseOrderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class InventoryTransactionConfiguration : IEntityTypeConfiguration<InventoryTransaction>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<InventoryTransaction> builder)
|
||||
{
|
||||
builder.Property(e => e.ModuleId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ModuleName)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.ModuleCode)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.ModuleNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.WarehouseId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ProductId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.WarehouseFromId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.WarehouseToId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Warehouse)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.WarehouseId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.Product)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProductId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.WarehouseFrom)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.WarehouseFromId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.WarehouseTo)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.WarehouseToId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.MovementDate);
|
||||
builder.HasIndex(e => e.WarehouseId);
|
||||
builder.HasIndex(e => e.ProductId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class InvoiceConfiguration : IEntityTypeConfiguration<Invoice>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Invoice> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.SalesOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.SalesOrder)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.SalesOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.InvoiceDate);
|
||||
builder.HasIndex(e => e.SalesOrderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PaymentDisburseConfiguration : IEntityTypeConfiguration<PaymentDisburse>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PaymentDisburse> builder)
|
||||
{
|
||||
builder.Property(e => e.BillId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.PaymentMethodId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Bill)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.BillId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.PaymentMethod)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.PaymentMethodId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.BillId);
|
||||
builder.HasIndex(e => e.PaymentMethodId);
|
||||
builder.HasIndex(e => e.PaymentDate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PaymentMethodConfiguration : IEntityTypeConfiguration<PaymentMethod>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PaymentMethod> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PaymentReceiveConfiguration : IEntityTypeConfiguration<PaymentReceive>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PaymentReceive> builder)
|
||||
{
|
||||
builder.Property(e => e.InvoiceId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.PaymentMethodId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Invoice)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.InvoiceId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.PaymentMethod)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.PaymentMethodId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.InvoiceId);
|
||||
builder.HasIndex(e => e.PaymentMethodId);
|
||||
builder.HasIndex(e => e.PaymentDate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class ProductConfiguration : IEntityTypeConfiguration<Product>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Product> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.UnitMeasureId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ProductGroupId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.UnitMeasure)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.UnitMeasureId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.ProductGroup)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProductGroupId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.UnitMeasureId);
|
||||
builder.HasIndex(e => e.ProductGroupId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class ProductGroupConfiguration : IEntityTypeConfiguration<ProductGroup>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProductGroup> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class ProgramManagerConfiguration : IEntityTypeConfiguration<ProgramManager>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProgramManager> builder)
|
||||
{
|
||||
builder.Property(e => e.Title)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Summary)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.ProgramManagerResourceId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.ProgramManagerResource)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProgramManagerResourceId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.Title);
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.ProgramManagerResourceId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class ProgramManagerResourceConfiguration : IEntityTypeConfiguration<ProgramManagerResource>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProgramManagerResource> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PurchaseOrderConfiguration : IEntityTypeConfiguration<PurchaseOrder>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PurchaseOrder> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.VendorId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.TaxId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Vendor)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.VendorId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.Tax)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.TaxId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasMany(e => e.PurchaseOrderItemList)
|
||||
.WithOne(e => e.PurchaseOrder)
|
||||
.HasForeignKey(e => e.PurchaseOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.OrderDate);
|
||||
builder.HasIndex(e => e.VendorId);
|
||||
builder.HasIndex(e => e.TaxId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PurchaseOrderItemConfiguration : IEntityTypeConfiguration<PurchaseOrderItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PurchaseOrderItem> builder)
|
||||
{
|
||||
builder.Property(e => e.PurchaseOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ProductId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.Summary)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.HasOne(e => e.PurchaseOrder)
|
||||
.WithMany(e => e.PurchaseOrderItemList)
|
||||
.HasForeignKey(e => e.PurchaseOrderId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(e => e.Product)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProductId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.PurchaseOrderId);
|
||||
builder.HasIndex(e => e.ProductId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PurchaseRequisitionConfiguration : IEntityTypeConfiguration<PurchaseRequisition>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PurchaseRequisition> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.VendorId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.TaxId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Vendor)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.VendorId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.Tax)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.TaxId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasMany(e => e.PurchaseRequisitionItemList)
|
||||
.WithOne(e => e.PurchaseRequisition)
|
||||
.HasForeignKey(e => e.PurchaseRequisitionId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.RequisitionDate);
|
||||
builder.HasIndex(e => e.VendorId);
|
||||
builder.HasIndex(e => e.TaxId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PurchaseRequisitionItemConfiguration : IEntityTypeConfiguration<PurchaseRequisitionItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PurchaseRequisitionItem> builder)
|
||||
{
|
||||
builder.Property(e => e.PurchaseRequisitionId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ProductId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.Summary)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.HasOne(e => e.PurchaseRequisition)
|
||||
.WithMany(e => e.PurchaseRequisitionItemList)
|
||||
.HasForeignKey(e => e.PurchaseRequisitionId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(e => e.Product)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProductId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.PurchaseRequisitionId);
|
||||
builder.HasIndex(e => e.ProductId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class PurchaseReturnConfiguration : IEntityTypeConfiguration<PurchaseReturn>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PurchaseReturn> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.GoodsReceiveId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.GoodsReceive)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.GoodsReceiveId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.ReturnDate);
|
||||
builder.HasIndex(e => e.GoodsReceiveId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class SalesOrderConfiguration : IEntityTypeConfiguration<SalesOrder>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SalesOrder> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.CustomerId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.TaxId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Customer)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.CustomerId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.Tax)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.TaxId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasMany(e => e.SalesOrderItemList)
|
||||
.WithOne(e => e.SalesOrder)
|
||||
.HasForeignKey(e => e.SalesOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.OrderDate);
|
||||
builder.HasIndex(e => e.CustomerId);
|
||||
builder.HasIndex(e => e.TaxId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class SalesOrderItemConfiguration : IEntityTypeConfiguration<SalesOrderItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SalesOrderItem> builder)
|
||||
{
|
||||
builder.Property(e => e.SalesOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ProductId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.Summary)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.HasOne(e => e.SalesOrder)
|
||||
.WithMany(e => e.SalesOrderItemList)
|
||||
.HasForeignKey(e => e.SalesOrderId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(e => e.Product)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProductId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.SalesOrderId);
|
||||
builder.HasIndex(e => e.ProductId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class SalesQuotationConfiguration : IEntityTypeConfiguration<SalesQuotation>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SalesQuotation> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.CustomerId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.TaxId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Customer)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.CustomerId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.Tax)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.TaxId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasMany(e => e.SalesQuotationItemList)
|
||||
.WithOne(e => e.SalesQuotation)
|
||||
.HasForeignKey(e => e.SalesQuotationId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.QuotationDate);
|
||||
builder.HasIndex(e => e.CustomerId);
|
||||
builder.HasIndex(e => e.TaxId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class SalesQuotationItemConfiguration : IEntityTypeConfiguration<SalesQuotationItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SalesQuotationItem> builder)
|
||||
{
|
||||
builder.Property(e => e.SalesQuotationId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.ProductId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.Summary)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.HasOne(e => e.SalesQuotation)
|
||||
.WithMany(e => e.SalesQuotationItemList)
|
||||
.HasForeignKey(e => e.SalesQuotationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(e => e.Product)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.ProductId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.SalesQuotationId);
|
||||
builder.HasIndex(e => e.ProductId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class SalesReturnConfiguration : IEntityTypeConfiguration<SalesReturn>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SalesReturn> builder)
|
||||
{
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.DeliveryOrderId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.DeliveryOrder)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.DeliveryOrderId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.ReturnDate);
|
||||
builder.HasIndex(e => e.DeliveryOrderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class LogConfiguration : IEntityTypeConfiguration<SerilogLogs>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SerilogLogs> builder)
|
||||
{
|
||||
builder.ToTable("SerilogLogs");
|
||||
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
builder.Property(e => e.Message)
|
||||
.HasMaxLength(2000);
|
||||
|
||||
builder.Property(e => e.Level)
|
||||
.HasMaxLength(128);
|
||||
|
||||
builder.Property(e => e.TimeStamp)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(e => e.Exception)
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
builder.Property(e => e.Properties)
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
builder.Property(e => e.MessageTemplate)
|
||||
.HasMaxLength(2000);
|
||||
|
||||
builder.Property(e => e.LogEvent)
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
builder.HasIndex(e => e.TimeStamp)
|
||||
.HasDatabaseName("IX_SerilogLogs_TimeStamp");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class TaxConfiguration : IEntityTypeConfiguration<Tax>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Tax> builder)
|
||||
{
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Code)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.PercentageValue)
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
builder.Property(e => e.Category)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.Code).IsUnique();
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class TodoConfiguration : IEntityTypeConfiguration<Todo>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Todo> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasMany(e => e.TodoItemList)
|
||||
.WithOne(e => e.Todo)
|
||||
.HasForeignKey(e => e.TodoId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class TodoItemConfiguration : IEntityTypeConfiguration<TodoItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TodoItem> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.TodoId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Todo)
|
||||
.WithMany(e => e.TodoItemList)
|
||||
.HasForeignKey(e => e.TodoId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.TodoId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class UnitMeasureConfiguration : IEntityTypeConfiguration<UnitMeasure>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UnitMeasure> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class VendorCategoryConfiguration : IEntityTypeConfiguration<VendorCategory>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<VendorCategory> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class VendorConfiguration : IEntityTypeConfiguration<Vendor>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Vendor> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.Street)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.City)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.State)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.ZipCode)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Country)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.PhoneNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.FaxNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.EmailAddress)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Website)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.WhatsApp)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.LinkedIn)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Facebook)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Instagram)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.TwitterX)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.TikTok)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.VendorGroupId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.Property(e => e.VendorCategoryId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.VendorGroup)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.VendorGroupId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(e => e.VendorCategory)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.VendorCategoryId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasMany(e => e.VendorContactList)
|
||||
.WithOne(e => e.Vendor)
|
||||
.HasForeignKey(e => e.VendorId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.VendorGroupId);
|
||||
builder.HasIndex(e => e.VendorCategoryId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class VendorContactConfiguration : IEntityTypeConfiguration<VendorContact>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<VendorContact> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.AutoNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.JobTitle)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.PhoneNumber)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.EmailAddress)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.Property(e => e.VendorId)
|
||||
.HasMaxLength(GlobalConsts.StringLengthId);
|
||||
|
||||
builder.HasOne(e => e.Vendor)
|
||||
.WithMany(e => e.VendorContactList)
|
||||
.HasForeignKey(e => e.VendorId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
||||
builder.HasIndex(e => e.VendorId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class VendorGroupConfiguration : IEntityTypeConfiguration<VendorGroup>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<VendorGroup> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Indotalent.Shared.Consts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
||||
|
||||
public class WarehouseConfiguration : IEntityTypeConfiguration<Warehouse>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Warehouse> builder)
|
||||
{
|
||||
builder.Property(e => e.Name)
|
||||
.HasMaxLength(GlobalConsts.StringLengthShort);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
||||
|
||||
builder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Indotalent.Infrastructure.Database.MsSQL;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
public static class MsSQLConfiguration
|
||||
{
|
||||
public static IServiceCollection AddMsSQLContext<TContext>(this IServiceCollection services, string connectionString)
|
||||
where TContext : DbContext
|
||||
{
|
||||
services.AddDbContext<TContext>(options =>
|
||||
options.UseSqlServer(connectionString, m =>
|
||||
m.MigrationsAssembly(typeof(TContext).Assembly.FullName)));
|
||||
return services;
|
||||
}
|
||||
|
||||
public static void InitializeDatabase<TContext>(IServiceProvider serviceProvider) where TContext : DbContext
|
||||
{
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var context = scope.ServiceProvider.GetRequiredService<TContext>();
|
||||
context.Database.EnsureCreated();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user