initial commit

This commit is contained in:
2026-07-21 14:22:06 +07:00
commit 2d7959f202
572 changed files with 45295 additions and 0 deletions
@@ -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,31 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class AppraisalConfiguration : IEntityTypeConfiguration<Appraisal>
{
public void Configure(EntityTypeBuilder<Appraisal> builder)
{
builder.Property(a => a.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(a => a.LastRating).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.AppraisalType).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.AppraisalNote).HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(a => a.Status).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.CurrentSalary).HasColumnType("decimal(18,2)");
builder.Property(a => a.IncrementPercentage).HasColumnType("decimal(18,2)");
builder.Property(a => a.NewSalary).HasColumnType("decimal(18,2)");
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(a => a.EmployeeId);
builder.HasOne(a => a.Employee)
.WithMany()
.HasForeignKey(a => a.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
}
}
@@ -0,0 +1,24 @@
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.TenantId, e.EntityName, e.Year, e.Month }).IsUnique();
}
}
@@ -0,0 +1,56 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class BranchConfiguration : IEntityTypeConfiguration<Branch>
{
public void Configure(EntityTypeBuilder<Branch> 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.Description)
.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.OtherInformation1)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.OtherInformation2)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.OtherInformation3)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.Name);
builder.HasIndex(e => e.City);
}
}
@@ -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 => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.Name);
builder.HasIndex(e => e.Email);
builder.HasIndex(e => e.CurrencyId);
}
}
@@ -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 => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.Name);
}
}
@@ -0,0 +1,37 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class DeductionConfiguration : IEntityTypeConfiguration<Deduction>
{
public void Configure(EntityTypeBuilder<Deduction> 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.Category)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.CalculationMethod)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Status)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.Name);
}
}
@@ -0,0 +1,40 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class DepartmentConfiguration : IEntityTypeConfiguration<Department>
{
public void Configure(EntityTypeBuilder<Department> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.CostCenter)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Name)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.HeadOfDeptartment)
.HasMaxLength(GlobalConsts.StringLengthShort);
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 => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.CostCenter }).IsUnique();
builder.HasIndex(e => e.Name);
}
}
@@ -0,0 +1,40 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class DesignationConfiguration : IEntityTypeConfiguration<Designation>
{
public void Configure(EntityTypeBuilder<Designation> 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.Description)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.Level)
.HasMaxLength(GlobalConsts.StringLengthShort);
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 => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.Name);
}
}
@@ -0,0 +1,167 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class EmployeeConfiguration : IEntityTypeConfiguration<Employee>
{
public void Configure(EntityTypeBuilder<Employee> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Code)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.FirstName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.MiddleName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.LastName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.JobDescription)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.GradeId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.BranchId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.DepartmentId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.DesignationId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.BasicSalary)
.HasColumnType("decimal(18,2)");
builder.Property(e => e.SalaryBankName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.SalaryBankAccountName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.SalaryBankAccountNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.PlaceOfBirth)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Gender)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.MaritalStatus)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Religion)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.BloodType)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.IdentityNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.TaxNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.LastEducation)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EmployeeStatus)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EmploymentType)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.StreetAddress)
.HasMaxLength(GlobalConsts.StringLengthShort);
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.StringLengthShort);
builder.Property(e => e.SocialMediaX)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.SocialMediaFacebook)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.SocialMediaInstagram)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.SocialMediaTikTok)
.HasMaxLength(GlobalConsts.StringLengthShort);
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.HasOne(e => e.Grade)
.WithMany()
.HasForeignKey(e => e.GradeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Branch)
.WithMany()
.HasForeignKey(e => e.BranchId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Department)
.WithMany()
.HasForeignKey(e => e.DepartmentId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Designation)
.WithMany()
.HasForeignKey(e => e.DesignationId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasMany(e => e.EmployeeIncome)
.WithOne(ei => ei.Employee)
.HasForeignKey(ei => ei.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasMany(e => e.EmployeeDeduction)
.WithOne(ed => ed.Employee)
.HasForeignKey(ed => ed.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.FirstName);
builder.HasIndex(e => e.LastName);
builder.HasIndex(e => e.IdentityNumber);
builder.HasIndex(e => e.Email);
builder.HasIndex(e => e.GradeId);
builder.HasIndex(e => e.BranchId);
builder.HasIndex(e => e.DepartmentId);
builder.HasIndex(e => e.DesignationId);
}
}
@@ -0,0 +1,41 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class EmployeeDeductionConfiguration : IEntityTypeConfiguration<EmployeeDeduction>
{
public void Configure(EntityTypeBuilder<EmployeeDeduction> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EmployeeId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.DeductionId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Amount)
.HasPrecision(18, 2);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.EmployeeId);
builder.HasIndex(e => e.DeductionId);
builder.HasOne(e => e.Employee)
.WithMany(p => p.EmployeeDeduction)
.HasForeignKey(e => e.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Deduction)
.WithMany()
.HasForeignKey(e => e.DeductionId)
.OnDelete(DeleteBehavior.NoAction);
}
}
@@ -0,0 +1,41 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class EmployeeIncomeConfiguration : IEntityTypeConfiguration<EmployeeIncome>
{
public void Configure(EntityTypeBuilder<EmployeeIncome> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EmployeeId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.IncomeId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Amount)
.HasPrecision(18, 2);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.EmployeeId);
builder.HasIndex(e => e.IncomeId);
builder.HasOne(e => e.Employee)
.WithMany(p => p.EmployeeIncome)
.HasForeignKey(e => e.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Income)
.WithMany()
.HasForeignKey(e => e.IncomeId)
.OnDelete(DeleteBehavior.NoAction);
}
}
@@ -0,0 +1,35 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class EvaluationConfiguration : IEntityTypeConfiguration<Evaluation>
{
public void Configure(EntityTypeBuilder<Evaluation> builder)
{
builder.Property(e => e.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.EvaluatorId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.Period).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.FinalScore).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Rating).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EvaluationNote).HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.Status).HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.EmployeeId);
builder.HasIndex(e => e.EvaluatorId);
builder.HasOne(e => e.Employee)
.WithMany()
.HasForeignKey(e => e.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Evaluator)
.WithMany()
.HasForeignKey(e => e.EvaluatorId)
.OnDelete(DeleteBehavior.NoAction);
}
}
@@ -0,0 +1,37 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class GradeConfiguration : IEntityTypeConfiguration<Grade>
{
public void Configure(EntityTypeBuilder<Grade> 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.Status)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.SalaryFrom)
.HasColumnType("decimal(18,2)");
builder.Property(e => e.SalaryTo)
.HasColumnType("decimal(18,2)");
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.Name);
}
}
@@ -0,0 +1,37 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class IncomeConfiguration : IEntityTypeConfiguration<Income>
{
public void Configure(EntityTypeBuilder<Income> 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.Type)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.CalculationBase)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Status)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
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 LeaveBalanceConfiguration : IEntityTypeConfiguration<LeaveBalance>
{
public void Configure(EntityTypeBuilder<LeaveBalance> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasOne(e => e.Employee)
.WithMany()
.HasForeignKey(e => e.EmployeeId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasOne(e => e.LeaveCategory)
.WithMany()
.HasForeignKey(e => e.LeaveCategoryId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.Year);
builder.HasIndex(e => new { e.TenantId, e.EmployeeId, e.LeaveCategoryId, e.Year }).IsUnique();
}
}
@@ -0,0 +1,31 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class LeaveCategoryConfiguration : IEntityTypeConfiguration<LeaveCategory>
{
public void Configure(EntityTypeBuilder<LeaveCategory> 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.Description)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.Status)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
builder.HasIndex(e => e.Name);
}
}
@@ -0,0 +1,45 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class LeaveRequestConfiguration : IEntityTypeConfiguration<LeaveRequest>
{
public void Configure(EntityTypeBuilder<LeaveRequest> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Reason)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.Status)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.AttachmentPath)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.ApproverId)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.RejectReason)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.HasOne(e => e.Employee)
.WithMany()
.HasForeignKey(e => e.EmployeeId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasOne(e => e.LeaveCategory)
.WithMany()
.HasForeignKey(e => e.LeaveCategoryId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.Status);
builder.HasIndex(e => e.StartDate);
builder.HasIndex(e => e.EndDate);
}
}
@@ -0,0 +1,32 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class PayrollComponentConfiguration : IEntityTypeConfiguration<PayrollComponent>
{
public void Configure(EntityTypeBuilder<PayrollComponent> builder)
{
builder.Property(e => e.PayrollDetailId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.ComponentName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.ComponentType)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasOne(e => e.PayrollDetail)
.WithMany(d => d.Components)
.HasForeignKey(e => e.PayrollDetailId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasIndex(e => e.ComponentName);
}
}
@@ -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 PayrollDetailConfiguration : IEntityTypeConfiguration<PayrollDetail>
{
public void Configure(EntityTypeBuilder<PayrollDetail> builder)
{
builder.Property(e => e.PayrollProcessId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.EmployeeId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.EmployeeCode)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.EmployeeName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasOne(e => e.PayrollProcess)
.WithMany()
.HasForeignKey(e => e.PayrollProcessId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.Employee)
.WithMany()
.HasForeignKey(e => e.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasIndex(e => e.EmployeeCode);
}
}
@@ -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 PayrollProcessConfiguration : IEntityTypeConfiguration<PayrollProcess>
{
public void Configure(EntityTypeBuilder<PayrollProcess> builder)
{
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.PeriodName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Status)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.ProcessedBy)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.PeriodName);
}
}
@@ -0,0 +1,27 @@
using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class PromotionConfiguration : IEntityTypeConfiguration<Promotion>
{
public void Configure(EntityTypeBuilder<Promotion> builder)
{
builder.Property(p => p.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(p => p.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(p => p.FromGrade).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(p => p.ToGrade).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(p => p.PromotionNote).HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(p => p.Status).HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(p => p.EmployeeId);
builder.HasOne(p => p.Employee)
.WithMany()
.HasForeignKey(p => p.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
}
}
@@ -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 => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => new { e.TenantId, e.Code }).IsUnique();
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 TransferConfiguration : IEntityTypeConfiguration<Transfer>
{
public void Configure(EntityTypeBuilder<Transfer> builder)
{
builder.Property(t => t.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(t => t.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.FromBranchId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.FromDepartmentId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.FromDesignationId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.ToBranchId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.ToDepartmentId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.ToDesignationId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(t => t.TransferNote).HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(t => t.Status).HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(t => t.EmployeeId);
builder.HasOne(t => t.Employee).WithMany().HasForeignKey(t => t.EmployeeId).OnDelete(DeleteBehavior.NoAction);
builder.HasOne(t => t.FromBranch).WithMany().HasForeignKey(t => t.FromBranchId).OnDelete(DeleteBehavior.NoAction);
builder.HasOne(t => t.FromDepartment).WithMany().HasForeignKey(t => t.FromDepartmentId).OnDelete(DeleteBehavior.NoAction);
builder.HasOne(t => t.FromDesignation).WithMany().HasForeignKey(t => t.FromDesignationId).OnDelete(DeleteBehavior.NoAction);
builder.HasOne(t => t.ToBranch).WithMany().HasForeignKey(t => t.ToBranchId).OnDelete(DeleteBehavior.NoAction);
builder.HasOne(t => t.ToDepartment).WithMany().HasForeignKey(t => t.ToDepartmentId).OnDelete(DeleteBehavior.NoAction);
builder.HasOne(t => t.ToDesignation).WithMany().HasForeignKey(t => t.ToDesignationId).OnDelete(DeleteBehavior.NoAction);
}
}
@@ -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();
}
}